After clicking on logout button the related controller does not call so logout activity never happens.
I have written a login page using AngularJs and Spring boot and Security which is working fine in case of login but logout is not working.
I have just pasted the related parts of the files and pages.
index.html
<nav class="navbar navbar-default">
<div class="container-fluid">
<div ng-show="authenticated">
<a href="#/"
class="btn btn-info navbar-btn"
role="button">
Home
</a>
<a href="#/register-new-user"
class="btn btn-info navbar-btn"
role="button">
Register New User
</a>
<a href="#/list-all-users"
class="btn btn-info"
role="button">
List All Users
</a>
**<a href="#/logout"
class="btn btn-danger navbar-btn pull-right"
role="button">Logout
</a>**
</div>
</div>
</nav>
app.js to rout the written URL
.when('/login',{
templateUrl : '/login/login.html',
controller : 'loginController'
})
**.when('/logout',{
templateUrl : '/login/login.html',
controller : 'logoutController'
})**
.otherwise({
redirectTo : '/login'
});
controller.js to post the request to spring security.
app.controller('logoutController', function($rootScope, $scope, $http, $location, $route){
console.log("inside of logout controller...");
$scope.logout = function() {
$http.post('logout', {}).finally(function() {
$rootScope.authenticated = false;
$location.path("/");
});
}
});