I am trying to call the /auth/logoutredirect URL after deleting the session:
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
controller:'AuthLogout'
})
})
.controller('AuthLogout', ['$window','$location', function ($window,$location) {
$window.localStorage.removeItem('user_username');
$window.localStorage.removeItem('user_id');
$window.localStorage.removeItem('user_session_token');
$location.path('/');
}]);
I really do not need a view for the AuthLogout controller, but if I do not specify templateUrlin routeProvider, I cannot make it work, and if I specify << 22> it will work.
How can I call a url / controller without having to load a view?
source
share