http call on service variable is null

10 views
Skip to first unread message

Sivaprakash Gopal

unread,
Sep 30, 2019, 1:09:40 AM9/30/19
to Angular and AngularJS discussion
I am maintaining value in common service and it is being read and updated by different components.

we have issue while refresh the browser. Data stored in common service variable is wiped out, so render throws error.

Please suggest option to retrieve the value through API only when object is nul

Thanks,
Siva

Sander Elias

unread,
Oct 1, 2019, 3:56:17 AM10/1/19
to Angular and AngularJS discussion
Hi,

If you press the refresh button, your app is fully restarted from the get-go. If you want to retain your state between sessions you have to store it somewhere. (in the route, in local-storage, in indexedDB, in a cookie, or even in a session on your server)
Depending on how you store this, you can rehydrate your services.

Regards
Sander 
Reply all
Reply to author
Forward
0 new messages