hello guys i wanted to know how to manage like user session id,name throught the view controllers in Angular Js.
The senario is that i did http call and get user id and name. now i want to is use that whenever i want to in any controllers.
i tried with angular value service like setting
app.value("user",{user_id:"0",user_name:"blank"})
and http call where in a controller
app.controller("exampleCtrl",function($http,user){
user.user_id = data.user_id;
//lets say the user id is 4.
//and now user.user_id should be 4 as well
})
now in another controller
app.controller("nextCtrl",function(user){
console.log(user.user_id);
//gives me 0 which should be 4?
})
i though it would give me 4.
I hope you got the general idea of what i am trying to do is there another way to do things ? or am i doing it the wrong way? pLease guide me.
Thank You.