Office.initialize引发了$ rootScope:infdig

问题描述 投票:0回答:1

以前我的插件在不同的浏览器中运行良好。最近,在某些浏览器中它加载不好(控制台中的错误消息+只是在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的错误消息:

enter image description here

有谁知道什么是错的?

编辑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":""}]]
angularjs ms-office office-js html5-history office-app
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.