title: how do I declare a $rootscope in a controller and access it in another controller
body: <p>I am implementing an angular resource for a login system like this  </p>
  
  <p>..factory.js</p>
  
  <pre><code>//Create a factory for the Login API
  angular.module(...)
  .factory('LoginEntity', ['$resource', function ($resource) {
  return $resource(
      'API/sigin',
      {
          save: {method: 'POST'},
          update: {method: 'PUT'}
      }
  );
  }])
  </code></pre>
  
  <p>...controller.js</p>
  
  <pre><code>.controller('xxxController', ['LoginEntity', function(LoginEntity, $rootScope){
  //in Controller add LoginEntity dependency
    $rootScope.loggedinuser = {};
  
  LoginEntity.save({
                          username: user.userName,
                          password: user.password
                      },
                      function (response) {
                          //success callback
                        $rootScope.loggedinuser = response;
                      },
                      function () {
                          //error callback
  
                      });
  
  }]);
  </code></pre>
  
  <p>...AppCtrl </p>
  
  <pre><code>.controller('AppCtrl',function($scope,$rootScope){
  
     username = $rootScope.loggedinuser.username;
  
    }
  </code></pre>
  
  <p>That is what I have but the rootscope does not seem to be accesible in the App controller.</p>
  
  <p>Any help, or assistance will be highly appreciated</p>