有人可以告诉我们MEAN.JS [meanjs.org]中的身份验证是如何实际运行的吗? 当用户登录时,USER json对象存储在何处。代码是
// Authentication service for user variables
angular.module('users').factory('Authentication', [
function() {
var _this = this;
_this._data = {
user: window.user
};
return _this._data;
}
]);
//The implementation of the service in the controller
$scope.authentication=Authentication;
// If successful we assign the response to the global user model
$scope.authentication.user = response;
但在控制台window.user中返回null
另一个问题,该应用在刷新页面时如何保留用户JSON对象?刷新页面后,window.user返回用户JSON对象,我在本地存储或会话存储中看不到此对象,也没有看到任何ajax被提交给服务器以获取此对象。
由于