简体   繁体   English

AngularJS和IE10路由的问题。

[英]Issues with AngularJS and IE10 routing.

Often when I quickly switch between different angular modules/controllers in IE10, the necessary routing will never take place. 通常当我在IE10中的不同角度模块/控制器之间快速切换时,将永远不会发生必要的路由。 I'm left with my page skeleton where no content has loaded and the index controller was never hit, but the angular module was defined. 我留下了我的页面骨架,其中没有内容加载,索引控制器从未被命中,但角度模块已定义。 The URL also indicates that no routing has occurred (no appended #/). URL还表示没有发生路由(没有附加#/)。 My module is defined as such with AngularJS 1.0.7: 我的模块是用AngularJS 1.0.7定义的:

angular.module('Users', ['ngResource', 'localization', 'pagination', 'resourceService']).
    config(function ($routeProvider) {
    $routeProvider.
        when('/', {templateUrl: '../user/listAll.jsp',
            controller: ListUsersCtrl}).
        when('/edit/:userId', {templateUrl: '../user/edit.jsp',    controller: UserEditCtrl}).
        otherwise({redirectTo: '/'});
});

function ListUserCtrl($scope, $resource, $routeParams, $location, $timeout) {...}
function UserEditCtrl($scope, $resource, $routeParams, $location, $timeout) {...}

Again, this works fine most of the time, it's only about every 9th or 10th page reload that no routing will take place. 同样,这在大多数情况下都能很好地工作,它只是每次重新加载第9页或第10页时都不会发生路由。 Does anyone have any thoughts or suggestions as to why this may be happening? 有没有人对为什么会发生这种情况有任何想法或建议? It may be present in older versions of IE but I can't confirm that. 它可能存在于IE的旧版本中,但我无法确认。

I had a similar problem, solved it by forcing IE10 to IE9 Compatibility mode. 我遇到了类似的问题,通过强制IE10进入IE9兼容模式解决了这个问题。

Add this to your html head: 将其添加到您的html头:

<meta http-equiv="X-UA-Compatible" content="IE=9">

Try adding query string to force IE, eg: 尝试添加查询字符串以强制IE,例如:

<a ng-href="/test.aspx#/?iefix">Test</a>

Worked for me in IE11. 在IE11为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM