0

When the page built using the angular JS is refreshed, I am losing the state. Is there any way to keep the state.

Any help on this to handled this.

Patan
  • 17,073
  • 36
  • 124
  • 198
  • 1
    There are several approaches to accomplish this please see my answer [Here](http://stackoverflow.com/questions/25901096/passing-data-between-pages-in-angularjs-page-refresh/25903189#25903189) – Jared Reeves Oct 14 '14 at 12:34
  • @JaredReeves. Thanks for suggestion. I have tried solution with Service mentioned here https://medium.com/opinionated-angularjs/techniques-for-authentication-in-angularjs-applications-7bbf0346acec. But when the page is refreshed the data stored in Session service is lost. Can you help me with some example – Patan Oct 14 '14 at 12:41
  • @JaredReeves. I am using ngcookies only. Do you suggest any better approach. – Patan Oct 14 '14 at 13:45
  • How mush data are you needing to store and does it need to be persistent if you leave the page or close the browser? Then I can whip up an example for you based on this information. – Jared Reeves Oct 14 '14 at 14:10

1 Answers1

0

You can use the url (with get params - which is ugly), localStorage or cookies to save the state of your app.

The fastest way would be localStorage.

I should say that I don't use AngularJs, but I don't think is that hard to implement localStorage persistence.

Some packages that came up after a quick google search:

https://github.com/grevory/angular-local-storage

https://github.com/gsklee/ngStorage

Good luck.

mocanuga
  • 131
  • 4