我已经实现了身份验证系统,从角度1.0.8升级到1.2.x后,系统无法正常工作.当用户登录时获取令牌.令牌过期时,将调用新令牌的刷新功能.在服务器上成功创建新令牌,并将其存储到数据库.但是客户端没有获得这个新令牌,因此它再次请求一个新令牌,并一次又一次地请求它直到它注销.服务器端(MVC Web Api)工作正常,因此问题必须在客户端.问题必须在重试队列上.下面我粘贴了两个版本的应用程序(1.0.8和1.2.x)的相关代码和控制台跟踪.我现在正在努力奋斗这几天,我无法弄明白.
在下面的链接中,有5个相关的代码块:
代码:http://pastebin.com/Jy2mzLgj
应用程序的控制台跟踪角度为1.0.8:http://pastebin.com/aL0VkwdN
和角度1.2.x:http://pastebin.com/WFEuC6WB
angular.module('security.interceptor', ['security.retryQueue'])
.factory('securityInterceptor', ['$injector', 'securityRetryQueue', '$q',
function ($injector, queue, $q) {
return {
response: function(originalResponse) {
return originalResponse;
},
responseError: function (originalResponse) {
var exception;
if (originalResponse.headers){
exception = originalResponse.headers('x-eva-api-exception');
}
if (originalResponse.status === 401 &&
(exception === 'token_not_found' ||
exception === 'token_expired')){
queue.pushRetryFn(exception, function retryRequest() {
return $injector.get('$http')(originalResponse.config);
});
}
return $q.reject(originalResponse);
}
};
}])
.config(['$httpProvider', …
Run Code Online (Sandbox Code Playgroud) 当我升级时,ng-repeat需要非常长的时间来加载并尝试显示更多内容框而没有$ resource提供的内容.
我已将问题缩小到1.1.0和1.1.1之间的更新.我查看了更改日志,但没有任何东西突然出现在我身上,但它必须在那里.
Changelog => https://github.com/angular/angular.js/blob/master/CHANGELOG.md#111-pathological-kerning-2012-11-26
此应用程序的存储库=> https://github.com/brianpetro/resume
目前我的角度看起来像:
app = angular.module("Resume", ["ngResource"])
app.factory "Entry", ["$resource", ($resource) ->
$resource("/entries")
]
@EntryCtrl = ["$scope", "Entry", ($scope, Entry) ->
$scope.entries = Entry.query()
]
Run Code Online (Sandbox Code Playgroud)
使用ng-repeat在多个视图上发生这种情况:
<html ng-app="Resume">
<div ng-controller="EntryCtrl">
<ul>
<li ng-repeat="entry in entries">
{{entry.title}}
</li>
</ul>
</div>
</html>
Run Code Online (Sandbox Code Playgroud)
这是AngularJS版本1.1.0:
这是AngularJS版本1.1.1: