title: Display username on every webpage after login in Angular
body: <p>I'm using Satellizer for authentication in my Angular app and have pretty much everything working... except that I can't seem to figure out how to display the username  (or email) after successful login in the navbar.</p>
  
  <p>My login controller looks like this</p>
  
  <pre><code>$scope.login = function() {
     $auth.login($scope.user).then(function(response) {
        $scope.user = JSON.stringify(response.data.user);
        localStorage.setItem('user', user);
        $scope.user = response.data;
        $rootScope.authenticated = true;
        $rootScope.currentUser = response.data.user;
        // redirect user here after successful login
        $state.go('home');
     }
  }
  </code></pre>
  
  <p>I have this in my $states (using UI Router) for global access</p>
  
  <pre><code>.run(function ($rootScope, $auth, $state) {
      $rootScope.$on('$stateChangeStart', function (event, toState, fromState) {
          if (toState.loginRequired &amp;&amp; !$auth.isAuthenticated()) {
          //if ($auth.isAuthenticated()) {
              $rootScope.currentUser = JSON.parse($state, localStorage.currentUser);
          //$rootScope.currentUser = JSON.stringify($state, localStorage.currentUser);
              $state.go('/login');
              event.preventDefault();
          };
      });
    });
  </code></pre>
  
  <p>And then this in my navbar controller</p>
  
  <pre><code>.controller('NavbarCtrl', function($scope, $rootScope, $window, $auth) {
      $scope.isAuthenticated = function() {
        return $auth.isAuthenticated();
        $scope.user.email = $localStorage.currentUser.email;
      }
  }
  </code></pre>
  
  <p>I'm not getting any errors in the console, so I'm not sure exactly where I'm going wrong...?</p>
  
  <p>currentUser is undefined in the localStorage, I thought I was setting that in my login controller code above...?</p>