So right now I have configured html5mode.
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
This is end of my middelware for express to support html5mode
app.use(function (req, res) {
if (!req.path.match('/calendar|/user|/create|/profile')) {
return res.send(404);
}
res.render('home/index', {
currentUser: req.user
});
});
And all my urls are working good in Chrome and Firefox 3.6(which I'm using to test hashbang fallback).
My only issue is with the logout route. My logout is a server interaction. So I did this.
$rootScope.logout = function () {
window.location = '/logout';
};
And made an ng-click to this function and that worked for logging out in Chrome. How would I go about doing this in the hashbang fallback mode? It's not working in Firefox 3.6. Thanks!
Add a target="_self" to the link like this:
<a href="/logout" target="_self">Logout</a>
AngularJS ignore links with a target attribute. This is documented here: HTML link rewriting (search for _self).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With