linnovate/mean — pull request #374 by jackhsu978 (2014-04-05 10:36:40+00:00)
Title: centralizing global authenticated user data

Currently, there are two places that store the data of the authenticated user on the client-side: `Global.user` (in the `Global` service) and `$rootScope.user`. One problem is that it's not DRY and is harder to maintain. Another problem is that the index controller uses `Global.user` instead of `$rootScope.user`, but `Global.user` does not get updated when you log in. Instead of having two places to maintain, I'd like to make the `Global` service be the only place that holds the global data shared by all controllers. Instead of setting `$rootScope.user` and firing `$rootScope.emit`, a controller would only have to call `Global.setUser` and let `Global` service do the rest (i.e. broadcasting the change to all controllers).