I am implementing an angular resource for a login system like this 

..factory.js

```
//Create a factory for the Login API
angular.module(...)
.factory('LoginEntity', ['$resource', function ($resource) {
return $resource(
    'API/sigin',
    {
        save: {method: 'POST'},
        update: {method: 'PUT'}
    }
);
}])

```

...controller.js

```
.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

                    });

}]);

```

...AppCtrl 

```
.controller('AppCtrl',function($scope,$rootScope){

   username = $rootScope.loggedinuser.username;

  }

```

That is what I have but the rootscope does not seem to be accesible in the App controller.

Any help, or assistance will be highly appreciated