I'm trying to get the URL routing to jump to the correct page/view in angular spa setup
I have an index page setup like:
<html data-ng-app="app">
<body>
<div>
<div data-ng-include="'/app/layout/shell.html'"></div>
</div>
</body>
</html>
A shell page like:
<div data-ng-controller="ShellCtrl as vm">
<header>
<div data-ng-include="'/app/layout/topnav.html'"></div>
</header>
<section id="content" class="content">
<div data-ng-view></div>
</section>
</div>
And the topnav.html containing a navbar with links pointing to different pages like:
<ul class="nav navbar-nav">
<li class=""><a href="#/about"><span class="glyphicon glyphicon-info-sign"></span> About</a></li>
</ul>
Now when I click on the About link, it loads my about page in the content section like it should creating the URL
http://localhost/#/about"
And my routeprovider setup like:
app.config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) {
//$locationProvider.html5Mode(true);
$routeProvider.
when('/', {
templateUrl: 'app/partials/home.html',
controller: "HomeCtrl"
}).
when('/about', {
templateUrl: 'app/partials/about.html',
controller: 'AboutCtrl'
}).
when('/contact', {
templateUrl: 'app/partials/contact.html'
}).
otherwise({
redirectTo: '/'
});
}]);
Now I can switch to the pages in my app, but whenever i just throw in the url into a new window to 'bookmark' to the about page, it doesn't work, it doesn't load the about view. In fact, when i just load
http://localhost/
it doesn't load my home view either at first.
Am I missing a key piece to not get the URL routing to load my views properly from URL?