【问题标题】:scope().$apply(); isn't working in IE10范围().$apply();在 IE10 中不起作用
【发布时间】:2016-09-22 09:46:02
【问题描述】:

我的 JS:

function redirect(aPath) {
    var app = $('#divMain').injector();
    if (aPath == app.get('$location').path()) {
        app.get('$state').reload();
    }
    else {
        app.get('$location').path(aPath);
    }
    $('#divMain').scope().$apply();
}

这些情况在 Chrome 中运行良好,但在 IE 中,当我单击同一页面导航链接时,即“if”条件 scope().$apply() 不会触发。我错过了什么吗?

即使在 Chrome 中,平板电脑(iPad)也有相同的场景。

【问题讨论】:

  • 您使用的是什么版本的 SharePoint?
  • @Thriggle Sharepoint 2010
  • 在这种情况下,SharePoint 可能会强制 Internet Explorer 进入兼容模式,以模拟 IE8。针对 IE8 测试您的 JavaScript 并根据需要使用 polyfill。请注意,您需要明确使用 jQuery 1.12 来支持 IE8;最新版本的 jQuery 仅适用于 IE9+。

标签: javascript jquery angularjs internet-explorer sharepoint


【解决方案1】:

试试

angular.element($('#divMain')).scope().$apply();

【讨论】:

  • 还是一样。
猜你喜欢
  • 1970-01-01
  • 2012-11-23
  • 1970-01-01
  • 2013-12-02
  • 2013-11-13
  • 2013-08-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多