0

Already read this topic Angular not changing the path and Angular location path not working But still not get the idea why this thing happen.

Here is my function in controller.

$scope.logout = function () {

sessionService.destroy('isLoggedIn');   
sessionService.destroy('role'); 
sessionService.destroy('sessionToken');

if(sessionService.get('sessionToken') != null){
//$scope.isLoggedIn = true; 
$scope.hasNotsignedIn = false;  
}else {
$scope.hasNotsignedIn = true;   
//$scope.isLoggedIn = false;
}

$location.path("/"); //this not working 

}

$location already injected to controller and route already define. I have other $location.path in other function which is work correctly.

So is something missing or wrong with my code?

Community
  • 1
  • 1
Dark Cyber
  • 2,181
  • 7
  • 44
  • 68

1 Answers1

0

If the path is the same $location.path("/"); will not work.

You have to use $route.reload();

marcosspn
  • 376
  • 5
  • 14