How to stay logged in and preserve local storage after user closes app?

In these link most options describes, which might help to you.

If you want to use local storage then used as follow.
set variable in your login controller with local storage and if you want them used in entire application then defined such variable in factory file.

Set Local storage variable :

localStorage.setItem("var_1",value1);
localStorage.setItem("var_2",value2); and so on.

Get variable value in app.js file and check whether the login details like username, password, auth token and other information available or not :

localStorage.getItem("var_1");
localStorage.getItem("var_2"); and so on.

2 Likes