Mean Angular Ui-router Doesn't Load States
Solution 1:
You need configure the ng-app
in <html lang="en">
tag . and also you need to call (reference) all js files in index.html which you want to run.
If you have inject 3 controller's in 3 js files. you should be referred the js file in your index.js file.
Solution 2:
Solution 3:
I have found the problem, that is I defined duplicate route
app.use('/', function(req, res, err){
res.sendFile('index.html', {root: path.join(__dirname, '../client')})
})
in the routes.js file, and put it before
app.route('/*').get(function (req, res){
res.sendFile('index.html', {root: path.join(__dirname, '../client')});
});
After I delete the first code, it loads the state correctly.
Solution 4:
You have not included the script in the html..that the cause of the error.
just paste the code
<scriptsrc="/app.js"></script>
before </head>
tag so that your code becomes
<head><!---here leave the code same and just add this bottom script tag --><scriptsrc="/app.js"></script></head>
the above code will only work if your app.js is in /var/www/html
directory
and if the it is in another directory
say... /var/www/html/folder1/
then you have to use..
<script src="/folder1/app.js"></script>
Post a Comment for "Mean Angular Ui-router Doesn't Load States"