1

I have a angularjs app which reads json from java when the user is logged in:

$http({ method: 'POST', url: 'ws/login/user', data : user, cache: true })
.success(function (response) {                                                    
    $rootScope.userInfo = response; // Here I get the json                                          
    response = { success : true };                    
    callback(response);
}).error(function (response) {
    response = { success : false };
    response.message = 'Error.';
    callback(response);
});

Everything works fine until I press F5, then the JSON disappears.

How can I keep the data between page loads?

lucasbar
  • 35
  • 7

2 Answers2

2

You can use cookies or Local Storage. A quick google search shows this library: https://github.com/grevory/angular-local-storage.

lxe
  • 7,051
  • 2
  • 20
  • 32
0

Modern web applications will use local storage to keep data between page loads. Here is a helpful answer to get you started.

How do I store data in local storage using Angularjs?

Community
  • 1
  • 1
Corey
  • 166
  • 3
  • 14