0

以前我的加载项在不同的浏览器中运行良好。最近,在某些浏览器中加载不好(控制台中的错误消息 + 只是在 UI 中显示一个空白页面);在某些浏览器中,它会加载,但控制台中会显示错误消息。奇怪的是,它在 中运行良好localhost,但在生产中却不行。这是最低限度的代码:

console.log("OfficeHelpers.Utilities.host: " + OfficeHelpers.Utilities.host);
console.log("OfficeHelpers.Utilities.platform: " + OfficeHelpers.Utilities.platform);

Office.initialize = function (reason) {
    jQuery(document).ready(function () {
        angular.bootstrap(document, ['test']) // it is important to not write 'ng-app="test"' in index.html, otherwise controller will be executed twice
        console.log("bootstrapped inside Office.initialize!");
    })
}

test = angular.module('test', ['ui.router']);
test.config(['$stateProvider', '$locationProvider', function ($stateProvider, $locationProvider) {
    $stateProvider
        .state('addinHomePlus', {
            url: '/addin/homePlus',
            template: 'testtest!!!'
        })
    $locationProvider.html5Mode(true);
}])

在 Chrome 中,它在 UI 中显示一个空白页面,下面是带有$rootScope:infdig的错误消息:

在此处输入图像描述

有谁知道出了什么问题?

编辑1:https://cdn.rawgit.com/devote/HTML5-History-API/master/history.js用来帮助html5模式。如果我设置$rootScopeProvider.digestTtl(3),我会收到以下消息$rootScope:infdig

3 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [null,[{"msg":"fn: function (){var a=jb(c.url()),b=jb(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(q||m)q=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast(\"$locationChangeStart\",b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&h(b,g,f===l.$$state?null:l.$$state),\nk(a,f)))});l.$$replace=!1}"},{"msg":"fn: function (){return d.hash()}","newVal":""}]]
4

1 回答 1

0

如果我不使用https://cdn.rawgit.com/devote/HTML5-History-API/master/history.js,这$rootScope:infdig将消失。但我确实需要这里history.js的建议。

于 2018-01-04T06:14:39.283 回答