I am using AngluarJS since 2 days and i am now trying to build my authentication system.
I have several controllers within i need to reflect connected user credentials. Something like:
<body>
<div ng-controller="topController">
<h1>{{User.name}}</h1>
</div>
<div ng-controller="contentController">
<h1>{{User.age}}</h1>
</div>
<div ng-controller="bottomController">
<h1>{{User.email}}</h1>
</div>
</body>
So since it's not appropriate to load the User into a controller, i guess the best way is to work with an external service and get it back on the different controllers's callbacks.
But by doing that, i am wondering how (where) could we load the session at the fisrt loading of the page (let's imagine i just have a single view to ignore the router mechanism) ? I am looking for a kind of "main" point.
I am using the facebook authentication so my question is not really about how to use the cookies with angular, but more about the "global logic" to set up.
If someone could give me an idea about how to do that, or give me some explanation about a best way to think the authentication mechanism, it would be nice !