Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Created August 17, 2013 10:28
Show Gist options
  • Save CMCDragonkai/6256263 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/6256263 to your computer and use it in GitHub Desktop.
JS: AngularJS with HTML5 URLs
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