server code:
app.get('/', function(req, res){
console.log('executed "/"')
res.render('home');
});
app.get('/partials/:name', function (req, res) {
console.log('executed partials:name');
var name = req.params.name;
console.log(name);
res.render('partials/' + name);
});
the code works perfectly before i put $locationProvider.html5Mode(true);
to convert '/#/' url into regular /
url.
After which, the console.log('executed partials:name');
fails to execute. Documentation says:-
Server side
Using this mode requires URL rewriting on server side, basically you have to rewrite all
your links to entry point of your application (e.g. index.html)
The changes I have tried are not working. What are changes to be made?
Edit: The following is the angular code:
var myApp = angular.module('myApp', []);
myApp.config(['$routeProvider', function($routeProvider, $locationProvider) {
$routeProvider.
when('/', {
templateUrl: 'partials/partial',
controller: 'homePage'
}).
otherwise({redirectTo: '/login'});
$locationProvider.html5Mode(true);
}]);
I again mention, the routing works perfectly well, till i add $locationProvider.html5Mode(true);
to angular.