2

I am using AngularJs in my Application.After user login I am storing user name through $window.sessionStorage and redirecting page to new url using $window.location.href ="some url"; But I am not able to get these values in new page load...my code will like this..

In login method

$rootScope.userLogged = true;

$window.localStorage.setItem('userLogged', $rootScope.userLogged);

$rootScope.loggedUserName = response.firstName;

$window.localStorage.setItem('loggedUserName', $rootScope.loggedUserName);

$window.location.href = "some url";

and in new app run configuration which is going to load after logi...

app.run(['$rootScope', '$window', function ($rootScope, $window) {


      if ($window.localStorage.getItem('userLogged') == "true") {


                $rootScope.userLogged = true;
                $rootScope.loggedUserName = $window.localStorage.getItem('loggedUserName');

      }
}]);

I used both sessionStorage and localstorage but I am not able to get values properly.

please help me

0 Answers0