Answer the question
In order to leave comments, you need to log in
How to change url via "otherwise" in angular+node without page reload?
On the client side:
app.config(['$locationProvider', '$routeProvider',
function($locationProvider, $routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'components/home.html',
controller: 'homeController'
})
.otherwise('/');
$locationProvider.html5Mode(true);
}]);
app.get('*', function(req, res, next) {
res.redirect('/#' + req.originalUrl);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question