Below is my controller code,
app.controller('logoutCtrl', ['$scope', '$http','$window','$state',
function ($scope, $http,$window,$state) {
$scope.logout = function() {
console.log('inside logmeout');
delete $window.sessionStorage.token;
$state.go('access.login');
};
}]);
HTML
<li class="last" ng-controller="logoutCtrl">
<a href="" ng-click="logout()">
<i class="material-icons">lock</i> Logout
</a>
</li>
app.router.js
.state('access', {
url: '/access',
template: '<div ui-view class=""></div>'
})
.state('access.login', {
url: '/login',
templateUrl: 'partials/ui-login.html',
controller: 'LoginFormController',
resolve: {
deps: ['uiLoad',
function(uiLoad) {
return uiLoad.load(['scripts/controllers/login.js',
'../bower_components/font-awesome/css/font-awesome.css']);
}
]
}
})
When clicking the logout i am not able to redirect to another state('access.login'). The control is coming inside the logout() and able to print the console message and is deleting the token as well but redirect not happening.. Can i get any help..