Office.initialize 提高 $rootScope:infdig

Office.initialize raises $rootScope:infdig

以前我的加载项在不同的浏览器中运行良好。最近,在某些浏览器中加载不正常(控制台中的错误消息 + 仅在 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":""}]]

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