title: Display User Data from Local Storage in Profile
body: <p>I'm just starting my first Ionic app and am a little confused. I'm using a rails API to login a user and then I would like to display user information on the Ionic app (Name, Email, etc...).</p>
  
  <p>I can't seem to pull in the user's email and name on my root page. Below is my code and I apologize for asking such a beginner level question.</p>
  
  <p><strong>services.js</strong></p>
  
  <pre><code>angular.module('starter.services', [])
  
  .factory('User', function($resource) {
    return $resource("http://localhost:3000/api/v1/users/:id.json");
  })
  
  .factory('UserSession', function($resource) {
    return $resource("http://localhost:3000/login.json");
  })
  </code></pre>
  
  <p><strong>controller.js</strong></p>
  
  <pre><code>angular.module('starter.controllers', [])
  
  .controller('DashCtrl', function($scope, User) {
    $scope.user = User.get(localStorage['userId']);
  })
  
  .controller('LoginCtrl', function($scope, $location, UserSession, $ionicPopup, $rootScope) {
    $scope.data = {};
  
    $scope.login = function() {
      var user_session = new UserSession({ user: $scope.data });
      user_session.$save(
        function(data){
          window.localStorage['userId'] = data.id;
          window.localStorage['userName'] = data.name;
          window.localStorage['userEmail'] = data.email;
          window.localStorage['userZip'] = data.zip;
          window.localStorage['userBalance'] = data.account_balance;
          $location.path('/tab/dash');
        },
        function(err){
          var error = err["data"]["error"]
          var confirmPopup = $ionicPopup.alert({
            title: 'An error occured',
            template: error
          });
        }
      );
    }
  });
  </code></pre>
  
  <p><strong>tab-dash.html</strong></p>
  
  <pre><code>&lt;ion-view title="Overview"&gt;
    &lt;ion-content class="padding"&gt;
      &lt;h2&gt;Name: {{user.name}}&lt;/h2&gt;
      &lt;p&gt;Email: {{user.email}}&lt;/p&gt;
    &lt;/ion-content&gt;
  &lt;/ion-view&gt;
  </code></pre>
  
  <p>As you can see from the screenshot below the name and email values aren't showing in my view.</p>
  
  <p><a href="https://i.stack.imgur.com/h7Hwt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h7Hwt.png" alt="enter image description here"></a></p>
  
  <p>Here is also a screenshot of the values saved in my localStorage.</p>
  
  <p><a href="https://i.stack.imgur.com/NWv3J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NWv3J.png" alt="enter image description here"></a></p>