mercredi 15 avril 2015

AngularJS routing to static file

I have a simple angularjs app, with ngRoute module for routing in html5Mode. How can I have a link to some static file on my page, and not to have it intercepted by angular routing mdule?


Here's the example:


HTML:



<a href="/">Home</a>
<a href="/user">User</a>
<a href="/users.html">users.html</a>

<div ng-view></div>


JS routing:



$routeProvider
.when('/', {
templateUrl: 'app/components/home/homeView.html',
controller: 'HomeController'

})
.when('/user', {
templateUrl: 'app/components/user/userView.html',
controller: 'UserController'

})
.otherwise({
redirectTo: '/'
});


When I click on User link i get routed to localhost:8080/user, and my controller and template work fine. When i click on users.html link I get routed to home, but I want to invoke a static home.html page.


Aucun commentaire:

Enregistrer un commentaire