【发布时间】:2015-03-13 22:10:20
【问题描述】:
我有一个 angularjs 应用程序,它在用户登录时从 java 读取 json:
$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);
});
一切正常,直到我按 F5,然后 JSON 消失。
如何在页面加载之间保留数据?
【问题讨论】:
-
Java 还是 JavaScript?两者完全不同。
-
后端是用Java开发的。我正在使用 RESTful 服务来获取 json。
-
为什么应用程序首先需要硬刷新?
-
应用程序不需要。只是为了防止用户意外刷新。