i have done route restriction in angular js app. when user is already logged in it should not move to login page.this is my code:
.run(function($rootScope, $location, Auth) {
$rootScope.$on('$routeChangeStart', function(event, next) {
Auth.isLoggedInAsync(function(loggedIn) {
if(loggedIn){ //when user loged in it should not move to login page
if ($location.path() == "/participant/login"){
event.preventDefault();
}
}
});
});
this code does not give any type of error.but it move to the login page when user is already logged in.i think here event.preventDefault() is not working.please suggest me if i am doing any mistake or if you have any good way to handle this issue ?