以下代码有什么问题?
错误消息如下:
错误:达到10次$ digest迭代。流产!观看者在
最近5次迭代:[]
http://errors.angularjs.org/1.6.4/$rootScope/infdig?p0=10&p1=%5B%5D
代码:
_permissionService.isAuthorizedRole = function(authorizedRoles) {
return new Promise((resolve, reject) => {
if (true) {
_permissionService.getPermissions().then(function(response) {
for (var i = 0; i < response.length; i++) {
if (response[i].componentName == authorizedRoles) {
return resolve('new');
}
}
});
} else {
return reject("promise failed");
}
});
}
$scope.isAuthorized = function(authorizedRoles) {
permissionService.isAuthorizedRole(authorizedRoles).then(res => {
var test = res;
console.log(test);
})
.catch(err => {
console.log(err);
});
};