【发布时间】:2017-08-25 09:31:13
【问题描述】:
我正在使用 Angular 创建一个 Outlook 插件。对于示例,我添加了任务窗格按钮以在 Outlook 中打开侧面板。索引页面加载后打开另一个组件。
问题是 Angular 组件未在 Outlook 2016 mac 中加载,但它适用于 Firefox、Chrome、Safari 浏览器。
您建议如何解决这样的问题?
注意:我已经用 Vorlon 在 mac 上测试了 Outlook。 Office.initialize 未加载并收到以下控制台消息。
- 尝试在对象“[object Navigator]”上使用描述符“{}”配置“userAgent”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
- 尝试在对象“[object Navigator]”上使用描述符“{}”配置“appVersion”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
- 尝试在对象“[object Navigator]”上使用描述符“{}”配置“appName”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
- 尝试在对象“[object Navigator]”上使用描述符“{}”配置“产品”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
- 尝试在对象“[object Navigator]”上使用描述符“{}”配置“vendor”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
我还发布了插件并检查了 F12 以在 Windows 上的 Outlook 中控制台消息。收到错误消息“SCRIPT5022:Office.js 尚未完全加载。请稍后重试或确保在 Office.initialize 函数中添加您的初始化代码。”
这是我的 main.ts 文件
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
declare let Office:any;
Office.initialize = (reason: any) => {
console.log('SampleAddin: initalizing office.js...');
// bootstrap
platformBrowserDynamic().bootstrapModule(AppModule)
.then((success: any) => {
console.log('SampleAddin: bootstrap success', success);
})
.catch((error: any) => {
console.log('SampleAddin: bootstrap error', error);
});
};
【问题讨论】:
-
您是否收到任何错误消息?
-
@MarcLaFleur-MSFT 没有收到任何错误,它刚刚加载了索引页面,没有在 Outlook Mac 中呈现角度组件
-
您是否设置了 Vorlon 以便可以看到控制台消息? Debugging with Vorlon.JS
-
谢谢,我试过了,但我认为用 https 测试 Vorlon。我会尝试。你有在 mac 中使用 Angular 2 插件的经验吗?效果好吗?
-
许多插件都使用 Angular。加载项确实需要 HTTPS,您不能通过 HTTP 使用它们(即使在开发中)。