我有一个平均堆栈网站。我想用ExecuteFunction绑定一个按钮,在对话框中推出这个网站:
function doSomethingAndShowDialog(event) {
clickEvent = event;
Office.context.ui.displayDialogAsync("https://localhost:3000/try", {}, function() {})
}
点击按钮将打开以下网址一个对话框,它显示页面的内容:
https://localhost:3000/try?_host_Info=excel|web|16.00|en-us|7fe9b4e9-d51e-bea5-d194-c817bc5ed4bc|isDialog#%2Ftry%3F_host_Info=excel%7Cweb%7C16.00%7Cen-us%7C7fe9b4e9-d51e-bea5-d194-c817bc5ed4bc%7CisDialog
然而,在控制台中,有在angular.bootstrap(document, ['myapp'])
是Error: $rootScope:infdig Infinite $digest Loop:
var wait = setTimeout(myFunction, 1000);
Office.initialize = function (reason) {
$(document).ready(function() {
angular.bootstrap(document, ['myapp'])
console.log("bootstrapped inside Office.initialize");
clearTimeout(wait);
})
}
function myFunction() {
$(document).ready(function() {
angular.bootstrap(document, ['myapp'])
console.log("bootstrapped outside Office.initialize");
})
}
app = angular.module("myapp", []);
app.config(...);
app.controller(...);
如果我们只是在浏览打开的https://localhost:3000/try
r,没有错误。
有谁知道为什么这个长的网址不适用于angular.bootstrap
?我们如何解决这个问题?
编辑1:控制台的屏幕截图https://localhost:3000/try?_host_Info=excel...
。请注意,不会显示bootstrapped inside Office.initialize
和bootstrapped outside Office.initialize
。但是,如果我在浏览器中运行https://localhost:3000/try
,我将只能看到bootstrapped outside Office.initialize
,当我从Excel客户端调用它时,我将只看到bootstrapped inside Office.initialize
。
在加载或定义模块后,您应该调用angular.bootstrap()。查看https://docs.angularjs.org/guide/bootstrap或更多详细信息。 – Vivz
“myapp”声明在哪里? – 31piy
你正在调用'angular.bootstrap(document,['myapp'])'两次检查它。你需要一次引导它。 –