Reputation: 1064
I want to switch off $locationProvider.html5Mode()
when the path goes out of my routes. (a.k.a. /pages).
The otherwise
route currently consumes my links to other pages and only updates the ng-view
with a blank template, I want the whole page reloads to target page instead.
Here is my code.
app.config(function($locationProvider, $routeProvider) {
$routeProvider.when('/page/:url', {
controller: 'PageCtrl',
templateUrl: 'page-template.html'
})
.otherwise({
redirectTo: function(params, path) {
window.location = path;
}
});
$locationProvider.html5Mode(true);
});
Upvotes: 1
Views: 1081
Reputation: 1064
I have found a work around to this, by adding all "reloading" links with a target="_self"
.
Below is a portion of RTFM.
In cases like the following, links are not rewritten; instead, the browser will perform a full page reload to the original link.
<a href="/ext/link?a=b" target="_self">link</a>
<a href="http://angularjs.org/">link</a>
<a href="/not-my-base/link/">link</a>
Upvotes: 2