我在angularjs中编写我的第一个应用程序,它给了我错误
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.3.13/$rootScope/infdig?p0=10&p1=%5B%5D
at ionic.bundle.js:8890
at Scope.$digest (ionic.bundle.js:23108)
at Scope.$apply (ionic.bundle.js:23333)
at bootstrapApply (ionic.bundle.js:10275)
at Object.invoke (ionic.bundle.js:13012)
at doBootstrap (ionic.bundle.js:10273)
at bootstrap (ionic.bundle.js:10293)
at angularInit (ionic.bundle.js:10187)
at ionic.bundle.js:34952
at HTMLDocument.trigger (ionic.bundle.js:11571)(anonymous function) @ ionic.bundle.js:20434
ionic.bundle.js:23336 Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.3.13/$rootScope/infdig?p0=10&p1=%5B%5D
ionic.bundle.js:20434 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.3.13/$rootScope/infdig?p0=10&p1=%5B%5D
at ionic.bundle.js:8890
at Scope.$digest (ionic.bundle.js:23108)
at Scope.$apply (ionic.bundle.js:23333)
at done (ionic.bundle.js:18486)
at completeRequest (ionic.bundle.js:18676)
at XMLHttpRequest.requestLoaded (ionic.bundle.js:18617)(anonymous function) @ ionic.bundle.js:20434
ionic.bundle.js:23336 Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
我的罪魁祸首app.js代码是
run(function ($rootScope, $state, AuthService, AUTH_EVENTS) {
$rootScope.$on('$stateChangeStart', function (event,next, nextParams, fromState) {
if (!AuthService.isAuthenticated()) {
if (next.name !== 'app.login') {
event.preventDefault();
$state.go('app.login');
}
}
});
});
如果我没有通过身份验证,我删除了将用户重定向到登录页面的最后一部分,我不会收到错误。在启动期间,如果我以
开头,它确实会多次进入循环domain.com/
为什么会这样?