When setting notify to true, the login.html does not render - it shows up as a blank page. However, if set to false, I receive multiple errors in the console:
RangeError: Maximum call stack size exceeded
at $.resolve (angular-ui-router.min.js:1)
at b (angular-ui-router.min.js:1)
at Object.x.transitionTo (angular-ui-router.min.js:1)
at Object.x.go (angular-ui-router.min.js:1)
at app.js:317
at p.$broadcast (angular.min.js:3)
at Object.x.transitionTo (angular-ui-router.min.js:1)
at Object.x.go (angular-ui-router.min.js:1)
at app.js:317
at p.$broadcast (angular.min.js:3)
My router code is as follows:
$rootScope.$on('$stateChangeStart',
function(event, toState, toParams, fromState, fromParams) {
var shouldLogin = !$window.sessionStorage.token && !AuthenticationService.isLogged;
$rootScope.Authenticated = shouldLogin;
//redirect only if both isAuthenticated is false and no token is set
// if (!AuthenticationService.isLogged && !$window.sessionStorage.token) {
// $state.go('login');
// }
//console.log($rootScope.Authenticated);
if(shouldLogin) {
$state.go('login', {}, {notify: false, location: false});
event.preventDefault();
return;
}
});