I'm developing my app in visual studio 2015 using ionic template and when I use:
.run(function ($rootScope, $state, AuthService) {
$rootScope.$on('$stateChangeStart', function (event,next, nextParams, fromState) {
if (!AuthService.isAuthenticated()) {
if (next.name !== 'login') {
event.preventDefault();
$state.go('login');
}
}
});
});
I get an error when testing the app. This is the error I get:
0x800a139e - JavaScript runtime error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: []
AuthService.isAuthenticated
is a synchronous method?AuthService