javascript - Should resource scripts in an AngularJS app be relative or absolute? -


I am creating an AngularJS single page-javascript app, so index.html looks like this:

> pre & lt; & Lt; Top & gt; & Lt; Base href = "/" /> ... & lt; / Head & gt; & Lt; Body id = "ng-app" ng-app = "myangularApp" & gt; & Lt; Div class = "holder" & gt; // templates from app.js are presented here & lt; / Div & gt; & Lt; Script src = "bower_components / angular / angular.js" & gt; & Lt; / Script & gt; & Lt; Script src = "bower_components / angular-route / angular-route.js" & gt; & Lt; / Script & gt; & Lt; Script src = "bower_components / angular-resource / angular-resource.js" & gt; & Lt; / Script & gt; & Lt; Script src = "script / ap js" & gt; & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;

I run this app in HTML5 MOD and are having trouble with fallback for legacy browsers. Whenever I browse IE8 on a location such as $ APPURL $ / login , then it's correctly $ APPURL $ / #! / Login , but when I do nested like $ APPURL $ / locations / my / home it does nothing (even not bootstrap) ) Because the cysts can not be found in this specific path. I had fixed this problem by making the script absolute (prefix with / ) on my script, but seeing all the examples of the Cunner app I used to use relative path instead of my example.

I serve my application with NGINX and have obtained the following examples from many examples:

  space / {try_files $ uri $ uri / / index Html; Root / home / web / appdir; }  

Is there any flaw in using the full path? Besides, why is it necessary? I really need legacy browser support but want to use HTML5mode .....

Problems with IE8 & lt; Base href = "/" /> is located in -tag, which is a relative URI and therefore ignore by IE.

Basically, whenever you browse http://my.app.io/where/does/this/go with the NGINX configuration above it will be redirected to http://my.app.io / index.html with the original URI to feed index.html . Then IE will try to resolve all the resources (scripts, pictures, and stylesheets) relative to the original URI and will not be able to break the application.

Now, when we reconfigure the base -tag is an absolute URI such as This problem persists now because IE gets all the resources relative to this base URI.

Thanks: and


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -