Reputation: 2785
app.run(function($rootScope, $location, $http, $state, Auth) {
if (Auth.isLoggedIn()) { <-- WORKS FINE
Auth.setUser(Auth.getUser());
}
$rootScope.$on('unauthenticated', function(response) {
// Redirect to login page
if (!Auth.IsLoggedIn()) { <-- Auth.IsLoggedIn is not a function
$state.go('login');
} else {
alert('no access to view this page');
}
});
$rootScope.$on('serverError', function(response) {
// $rootScope.serverError = "Server Error";
});
});
Any idea why I'm getting this 'Auth.IsLoggedIn is not a function' on line 8 but it's working fine on line 2?
Thanks!
Upvotes: 0
Views: 23
Reputation: 33865
You use a capital I in your method name, the second time you call it.
Auth.isLoggedIn()
Compared to:
Auth.IsLoggedIn()
Upvotes: 1