Could someone help me with calling the /auth/logout
url to get redirected after a session is deleted?
app.config(['$routeProvider',function($routeProvider) {
$routeProvider
.when('/auth/logout',{
controller:'AuthLogout'
//templateUrl: not needed
})
})
.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'm struggling because I don't actually need a view for the AuthLogout controller. However, if I do not specify the templateUrl
in routeProvider, I can't get this to work. But when I do specify a templateUrl
, it works.
Does anyone know how I can call the url/controller without having to load a view?