Sander,
Thank you so much, was able to use the cookieStore to persist the
information.
The way I've persisted the branch details is by setting the
$rootScope.branch= $cookieStore.get('branch') in the service.
This way, I'm able to now use the $rootScope.branch in the controller
which earlier was not possible after hitting F5 in the browser.
But in the service, if use the following code, I still end up getting
undefined after hitting F5 on the browser
$rootScope.branch = $cookieStore.get('branch') || null;
$cookieStore.remove('branch'); //Works well if I comment this line of code
not removing the branch info
which means I'm tied to using $cookieStore.
The question now is is this a right way or is there any better way of doing
this.
Best Regards
Madhukar
On Wednesday, May 14, 2014 2:00:12 PM UTC+5:30, Madhukar wrote:
>
> Sander,
>
> Thank you so much for your reply.
>
> The user information which is stored as $rootScope.currentUser=user is
> getting retrieved after hitting F5 multiple times.
> It could be that its getting stored in the cookie as you mention.
> I think I've tried using the cookieStore but ended up with
> $rootScope.currentBranch being undefined.
> Let me try again and will keep you posted.
>
> Best Regards
> Madhukar
>
> On Wednesday, May 14, 2014 1:35:27 PM UTC+5:30, Sander Elias wrote:
>>
>> Hi,
>>
>> Hitting F5 is the equivalent of closing and opening your browser. Hence,
>> you start fresh, with nothing in memory.
>> There is nothing angular cab do about that. If you want to retain your
>> users session you have to store it.
>> A cookie or localStorage are mostly used for this kind of stuff. Do not
>> store sensitive data this way.
>>
>> Regards
>> Sander
>>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.