我正在使用 AngularJS,我在这里有一个小问题。我刚刚让我的 httpInterceptor 服务在执行 ajaxRequests 时在网页上显示一个微调器,但是当我使用 IE 在 iFrame 中运行它时出现这个错误;使用 Chrome、Firefox 不会发生这种情况。这是拦截器的代码:
.factory('httpInterceptor', function ($q, $rootScope) {
return function (promise) {
$rootScope.$$childHead.spinner += 1;
return promise.then(function (response) {
$rootScope.$$childHead.spinner -= 1;
return response;
}, function (response) {
$rootScope.$$childHead.spinner -= 1;
return $q.reject(response);
});
};
}).config(function ($httpProvider) {
$httpProvider.responseInterceptors.push('httpInterceptor');
var spinnerFunction = function (data, headersGetter) {
return data;
};
$httpProvider.defaults.transformRequest.push(spinnerFunction);
});
出于某种原因,当我在 iFrame 中运行我的应用程序时,它会向我显示此错误:
Error: 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations:
我想知道这是因为在 iFrame 中运行它还是因为 promise 对象造成的。
我在使用 ng-repeat 时看到了这个错误,但我还没有找到原因。如果你有类似的问题,请给我一些建议。谢谢!