Created
August 17, 2013 10:28
-
-
Save CMCDragonkai/6256263 to your computer and use it in GitHub Desktop.
JS: AngularJS with HTML5 URLs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When ever you start an AngularJS project and you wish to use HTML5 urls. It is a | |
good practice to use the base tag. The base tag will set all your URLs relative | |
to what is set in the base, and that value could be set by your server side | |
templating language. | |
Example: | |
<html> | |
<head> | |
<base href="ENTER HOST ROOT" /> | |
<!-- Make sure that the base tag is the FIRST element underneath the head tag. --> | |
</head> | |
</html> | |
If you don't, you might run into problems with incorrect URL generation, | |
especially if some of the URLs should hit the server API, and some should hit | |
AngularJS's route matching state machine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment