My Angular front end includes the following code in app.js
to handle user logout:
.when('/logout', {
templateUrl: 'mysite/views/logout.html',
resolve: {
authenticated: ['djangoAuth', function(djangoAuth){
return djangoAuth.authenticationStatus();
}],
}
})
The logout.js
file contains:
'use strict';
angular.module('angularDjangoRegistrationAuthApp')
.controller('LogoutCtrl', function ($scope, $location, djangoAuth) {
djangoAuth.logout();
});
The content of logout.html
is as follows:
<div id="logout_view" ng-controller="LogoutCtrl">
<div class="alert alert-info">You have logged out.</div>
</div>
Everything works fine, but I want to redirect users to main.html
instead of showing the logout.html
page after clicking /logout
. However, when I change the templateUrl
to point to mysite/views/main.html
, the LogoutCtrl
is not executed and users are not properly logged out.
Question:
Is there a way to successfully redirect users to main.html
after they log out (meaning the logic in logout.js
is executed)?