I have a page that show the name of user after login, but, if a press F5 the page reloads and the name does not appear. How can I persist this information in the session?
-
This is a very broad question. What backend are you using? Is it a single page application or are you using cookies?caffeinated.tech– caffeinated.tech2014-03-10 20:05:01 +00:00Commented Mar 10, 2014 at 20:05
-
2My backend is Java using JAX-RS. Not using cookies, but, thinking use sessionStorage or localStorage.Luciano Borges– Luciano Borges2014-03-10 20:10:50 +00:00Commented Mar 10, 2014 at 20:10
Add a comment
|
3 Answers
Session Storage would be your first choice, take a look at the ngStorage module. I haven't tested it and it doesn't seem to be widely used but it's a good starting point even if you want to write your own implementation.
Though unless you have a good reason to go against cookies consider using the inbuilt $cookies service.
Comments
You can use the $cookieStore service. Docs can be found at http://docs.angularjs.org/api/ngCookies/service/$cookieStore