I am building an AngularJS single-page-javascript app, so the index.html looks something like:
<html>
<head>
<base href="/" />
...
</head>
<body id="ng-app" ng-app="myAngularApp">
<div class="holder">
//templates from app.js are rendered here
</div>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="scripts/app.js"></script>
</body>
</html>
I run this app in HTML5mode and am running into trouble with the fallback for legacy browsers. Whenever I browse in IE8 to a location like $APPURL$/login
it correctly rewrites to $APPURL$/#!/login
, but when I do a nested one like $APPURL$/locations/my/home
it does not do anything (not even bootstrap) because it can not find the scipts in this specific path.
I fixed this problem by making the refs to my scripts absolute (prefix it with an /
) but all examples of Angular Apps I looked at use relative paths like in my example instead.
I serve my application with NGINX and got the following configuration from numerous examples:
location / {
try_files $uri $uri/ /index.html;
root /home/web/appdir;
}
Is there any drawback to using absolute paths? Also, why is this necessary? I really need legacy browser support but want to keep using HTML5mode.....