角路由导致无限循环在IE浏览器 [英] Angular Routing Causes Infinite Loop In IE

查看:191
本文介绍了角路由导致无限循环在IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误,当我看到在Internet Explorer 10我的code(并不一定呈现在标准模式下,这是在我的掌握中,由于页面投放方式)。

I am receiving the following error when I look at my code in Internet Explorer 10 (it does not necessarily render in standards mode, this is out of my control due to the way the page is served).

<一个href=\"http://errors.angularjs.org/1.2.28/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3A%20function()%7Bvar%20a%3Dd.url()%2Cb%3Dh.%24%24replace%3Bn%26%26a%3D%3Dh.absUrl()%7C%7C(n%2B%2B%2Cc.%24evalAsync(function()%7Bc.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%5Cnh.absUrl()%2Ca).default$p$pvented%3Fh.%24%24parse(a)%3A(d.url(h.absUrl()%2Cb)%2Cg(a))%7D))%3Bh.%24%24replace%3D!1%3Breturn%20n%7D%3B%20newVal%3A%207%3B%20oldVal%3A%206%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20a%3Dd.url()%2Cb%3Dh.%24%24replace%3Bn%26%26a%3D%3Dh.absUrl()%7C%7C(n%2B%2B%2Cc.%24evalAsync(function()%7Bc.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%5Cnh.absUrl()%2Ca).default$p$pvented%3Fh.%24%24parse(a)%3A(d.url(h.absUrl()%2Cb)%2Cg(a))%7D))%3Bh.%24%24replace%3D!1%3Breturn%20n%7D%3B%20newVal%3A%208%3B%20oldVal%3A%207%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20a%3Dd.url()%2Cb%3Dh.%24%24replace%3Bn%26%26a%3D%3Dh.absUrl()%7C%7C(n%2B%2B%2Cc.%24evalAsync(function()%7Bc.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%5Cnh.absUrl()%2Ca).default$p$pvented%3Fh.%24%24parse(a)%3A(d.url(h.absUrl()%2Cb)%2Cg(a))%7D))%3Bh.%24%24replace%3D!1%3Breturn%20n%7D%3B%20newVal%3A%209%3B%20oldVal%3A%208%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20a%3Dd.url()%2Cb%3Dh.%24%24replace%3Bn%26%26a%3D%3Dh.absUrl()%7C%7C(n%2B%2B%2Cc.%24evalAsync(function()%7Bc.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%5Cnh.absUrl()%2Ca).default$p$pvented%3Fh.%24%24parse(a)%3A(d.url(h.absUrl()%2Cb)%2Cg(a))%7D))%3Bh.%24%24replace%3D!1%3Breturn%20n%7D%3B%20newVal%3A%2010%3B%20oldVal%3A%209%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20a%3Dd.url()%2Cb%3Dh.%24%24replace%3Bn%26%26a%3D%3Dh.absUrl()%7C%7C(n%2B%2B%2Cc.%24evalAsync(function()%7Bc.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%5Cnh.absUrl()%2Ca).default$p$pvented%3Fh.%24%24parse(a)%3A(d.url(h.absUrl()%2Cb)%2Cg(a))%7D))%3Bh.%24%24replace%3D!1%3Breturn%20n%7D%3B%20newVal%3A%2011%3B%20oldVal%3A%2010%22%5D%5D\"相对=nofollow> 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在我的索引:&LT;基本href =//&GT;
而且在页面中只重复:

The base href in my index: <base href="/" /> and also the only repeat in the page:

<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-重复的HTML,以确保我没有要求创建新阵列的方法。该基地的HREF似乎当我开发工具检查被称为不休。上什么可能导致这个错误有什么想法?

The page loads fine in Chrome, but when I try to pop it open in IE nothing loads. I've checked my html on the ng-repeat to make sure that I'm not calling a method that creates new arrays. The base href seems to be called endlessly when I inspect with developer tools. Any thoughts on what might be causing this error?

推荐答案

这是2期的组合。第一,改变

This is a combination of 2 issues. Number one, change

$locationProvider.html5Mode(true);

$locationProvider.html5Mode(false);

贝蒂的意见是正确的,有使用这种旧版本的IE浏览器的问题。除了这个,你需要创建一个新的路由仅售 / 。如果您遇到与角路线踢的问题,您可以拨打,否则除了了设置路线。有一个关于在href=\"https://docs.angularjs.org/tutorial/step_07#the-app-module\" rel=\"nofollow\">角文档的

Betty in the comments is correct, there is an issue with IE using this for older versions. In addition to this, you need to create a new route for just /. If you're having issues with angular routes kicking in, you can call otherwise in addition to when for setting up your routes. There's more information on that style of routing in the angular documentation.

这篇关于角路由导致无限循环在IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆