in app.js
$rootScope.$on('$stateChangeStart', function (event, next) {
if (next.authenticate && !Auth.isLoggedIn()) {
$location.path('/login');
}
});
Auth.isLoggedIn is returning false when the app is first run and the user is already logged in. Only when you switch state a second time does the function return true as the currentuser has then been set in the auth service. Could there is a timing issue of some sort?
in app.js
Auth.isLoggedIn is returning false when the app is first run and the user is already logged in. Only when you switch state a second time does the function return true as the currentuser has then been set in the auth service. Could there is a timing issue of some sort?