角度路由会导致 IE 中的无限循环
Angular Routing Causes Infinite Loop In IE
当我在Internet Explorer 10中查看我的代码时,我收到以下错误(它不一定在标准模式下呈现,由于页面的服务方式,这是我无法控制的)。
http://errors.angularjs.org/1.2.28/$rootScope/infdig
这是我使用的路由:
phoneApp.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider){
$routeProvider
.when('/sap.com~home~phonelist/pages/index.html', {
templateUrl: '/sap.com~home~phonelist/pages/landing.html',
controller: 'SearchController'
})
.when('/sap.com~home~phonelist/pages/', {
templateUrl: '/sap.com~home~phonelist/pages/landing.html',
controller: 'SearchController'
})
.when('/sap.com~home~phonelist/pages/singleEmployee/:id', {
templateUrl: '/sap.com~home~phonelist/pages/singleEmployee.html',
controller: 'SingleEmployeeController'
});
$locationProvider.html5Mode(true);
}]);
我的索引中的基本 href:<base href="/" />
也是页面中唯一的重复:
<tr ng-repeat="employee in filteredEmployees = (employees | filter:search.currentFilter | orderBy:user.ordering:reverse)">
<td> <a class="fakeLink" href="singleEmployee/{{$index}}">{{ employee.name }}</a></td>
<td class="location">{{ employee.userID }}</td>
<td class="district">{{ employee.department }}</td>
<td class="jobTitle">{{ employee.jobTitle }}</td>
<td class="emailAddress">{{ employee.email }}</td>
<td class="workPhone"><a class="fakeLink" href="tel:{{employee.phone}}">{{ employee.phone }}</a></td>
</tr>
该页面在Chrome中加载良好,但是当我尝试在IE中弹出它时,没有任何加载。我已经在 ng-repeat 上检查了我的 html,以确保我没有调用创建新数组的方法。当我使用开发人员工具进行检查时,似乎无休止地调用了基本 href。关于可能导致此错误的原因的任何想法?
这是 2 个问题的组合。第一,改变
$locationProvider.html5Mode(true);
自
$locationProvider.html5Mode(false);
评论中的贝蒂是正确的,IE在旧版本中使用它存在问题。除此之外,您还需要为/
创建新路线。如果您在角度路线启动时遇到问题,除了设置路线when
之外,您还可以致电otherwise
。角度文档中有关于这种路由样式的更多信息。
相关文章:
- 使用滚动溢出-x进行无限循环
- 从index.html调用函数,该函数无限循环
- 使用jQuery无限循环播放HTML页面幻灯片
- Grunt任务没有加载,获得无限循环
- 如何在不进入无限循环的情况下将网站重定向到Facebook画布URL
- Backbone+RequireJS+Mediator模式导致视图逻辑短路和无限循环
- jQuery无限循环,动画化许多项目
- 如何避免试图用php+jquery显示php起始页的无限循环
- 6502仿真增强型基本无限循环$C000至$E0ED
- Angular ngRoute导致无限循环和堆栈溢出
- Jquery:无限循环和暂停
- 数组数组:无限循环
- MeteorJS使用流星调用和流星方法时的无限循环
- 如何无限循环数据集字符串
- jquery在无限循环中运行
- 遍历对象会导致无限循环
- 为什么内部Javascript循环会阻止外部循环中断(即无限循环)
- 角度编译指令似乎进入了无限循环
- 代码在Chrome中工作,但在IE中无限循环
- 角度路由会导致 IE 中的无限循环