【发布时间】:2016-12-21 00:47:56
【问题描述】:
我是 Angular 的新手。
我正在尝试根据 API 的响应从当前页面重定向到另一个页面。
重定向正在发生,但代码在 IE 浏览器中无法正常运行,但在 Chrome 中运行正常。
有人可以帮忙解释一下为什么会出现这个错误吗?
IE 控制台出错:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
SCRIPT5022: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations:
JS 文件:
app.config(function($routeProvider){ $routeProvider
.when('/findCustomer', {
templateUrl: 'CustomerList.html',
controller: 'customerListController',
})
.when('/modifyCustomer', {
templateUrl: 'ModifyCustomer.html',
controller: 'modifyController',
})
客户列表控制器:
service.getCustomerList().then(function(data) {
if (data.length == 1) {
$window.location.href= "#/modifyCustomer";
}
【问题讨论】:
标签: angularjs