Office.initialize引发$ rootScope:infdig [英] Office.initialize raises $rootScope:infdig

查看:98
本文介绍了Office.initialize引发$ rootScope:infdig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前,我的加载项在不同的浏览器中运行良好.最近,在某些浏览器中,它的加载效果不佳(控制台中的错误消息+在用户界面中仅显示空白页);在某些浏览器中,它会加载,但控制台中会显示错误消息.奇怪的是,它在localhost中运行良好,但在生产中却不行.这是最小的代码:

Previously my add-in worked well in different browsers. Recently, in some browsers it does not load well (error messages in the console + just shows a blank page in UI); in some browsers it loads, but with error messages in the console. It is also odd that it works well in localhost, but not in production. Here is the minimum code:

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中,它在用户界面中显示空白页面,这是带有

In Chrome, it shows a blank page in UI and here are error messages with $rootScope:infdig:

有人知道怎么了吗?

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

Edit 1: I use https://cdn.rawgit.com/devote/HTML5-History-API/master/history.js to help html5 mode. If I set $rootScopeProvider.digestTtl(3), I got the following message for $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,如建议的此处.

If I don't use https://cdn.rawgit.com/devote/HTML5-History-API/master/history.js, this $rootScope:infdig will disappear. But I do need history.js as suggested here.

这篇关于Office.initialize引发$ rootScope:infdig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆