alarv / ng-login

Login/Authentication/Authorization logic on an AngularJS application
http://plnkr.co/edit/Mvrte4
MIT License
91 stars 33 forks source link

Use of $rootScope to contain currentUser #3

Open mcshaz opened 8 years ago

mcshaz commented 8 years ago

Thank you for this excellent piece of angular code. This is probably not an issue, but the parentController has the function

var setCurrentUser = function(){
    $scope.currentUser = $rootScope.currentUser;
}

Isn't enclosing the page contents in a parentController exactly for the specific reason of avoiding use of $rootScope (other than listeners)?

Vixxd commented 8 years ago

I ended up not even storing the currentUser in the rootScope, rather using the UserSession singleton :)