javascript - AngularJS Nginx Routing issue on Refresh -
i building angularjs app , have routing working first layer of routes:
ie: /blah /blah2 /blah3
however, when more complex route such as:
/blah/thing /blah2/things /blah3/things
these not routing correctly when refreshing page. work fine when clicking link them spa.
i running nginx following conf:
server { listen 80; root /home/app/public; index index.html; server_name dev-app.com; location / { try_files $uri $uri/ $uri.html /index.html; } }
and here example routes:
.when('/instances/running', { templateurl : 'pages/instances-running.html', controller : 'instancescontroller', currentpage : 'running instances', }) .when('/instances/stopped', { templateurl : 'pages/instances-stopped.html', controller : 'instancescontroller', currentpage : 'stopped instances', }) .when('/tickets/open', { templateurl : 'pages/tickets-open.html', controller : 'ticketscontroller', currentpage : 'open tickets', })
please let me know if can fix or inherently broken.
thanks!
had add / front of src="assets/.*" in index.html
<!-- angular && angular modules --> <script src="/assets/javascript/angular.min.js"></script> <script src="/assets/javascript/angular-datatables.min.js"></script> <script src="/assets/javascript/angular-route.js"></script> <script src="/assets/javascript/angular-aria.js"></script> <script src="/assets/javascript/angular-chart.js"></script> <script src="/assets/javascript/angular-jwt.min.js"></script> <script src="/assets/javascript/ng-context-menu.min.js"></script> <!-- app js && app modules --> <script src="/assets/javascript/app/app.js"></script> <script src="/assets/javascript/app/app-login.js"></script> <script src="/assets/javascript/app/app-sessions.js"></script> <script src="/assets/javascript/app/app-template.js"></script> <script src="/assets/javascript/app/app-dashboard.js"></script> <script src="/assets/javascript/app/app-account.js"></script>
Comments
Post a Comment