Saturday 18 March 2017

reload page in angular js

Hi guys am a beginner in mean stack development I have tried to refresh the page after logout.I have tried location.reaload(); but it doesn't work tell me the possible code for page reload in this scenario

$rootScope.$on('$routeChangeStart', function (event) {
    var storage = userService.isLoggedIn();
    console.log(storage);

    if (!storage) {
        console.log('DENY');
        $rootScope.adminlogin = "adminlogin";
        console.log($rootScope.adminlogin);

        $location.path('/login');
        $route.reload();      
       // $state.go('/login', null, {reload: true});
    }
    else {
        console.log('ALLOW');
        $rootScope.admindashboard = "admindashboard";
         var path = $location.path();
          console.log(path);
          console.log(storage);
         if(path == '/login'){
            $location.path('/');
         }


    }
});



via vimal kumar

No comments:

Post a Comment