【问题标题】:Angular component not loading under Outlook 2016 for MacAngular 组件未在 Outlook 2016 for Mac 下加载
【发布时间】:2017-08-25 09:31:13
【问题描述】:

我正在使用 Angular 创建一个 Outlook 插件。对于示例,我添加了任务窗格按钮以在 Outlook 中打开侧面板。索引页面加载后打开另一个组件。

问题是 Angular 组件未在 Outlook 2016 mac 中加载,但它适用于 Firefox、Chrome、Safari 浏览器。

您建议如何解决这样的问题?

注意:我已经用 Vorlon 在 mac 上测试了 Outlook。 Office.initialize 未加载并收到以下控制台消息。

  1. 尝试在对象“[object Navigator]”上使用描述符“{}”配置“userAgent”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
  2. 尝试在对象“[object Navigator]”上使用描述符“{}”配置“appVersion”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
  3. 尝试在对象“[object Navigator]”上使用描述符“{}”配置“appName”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
  4. 尝试在对象“[object Navigator]”上使用描述符“{}”配置“产品”并出错,放弃:TypeError: Attempting to change the getter of an unconfigurable property。
  5. 尝试在对象“[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 使用它们(即使在开发中)。

标签: angularjs office-js


【解决方案1】:

如果没有错误/警告,很难确定可能发生的情况。我建议查看以下资源:

  1. Tips for creating Office Add-ins with Angular

  2. Debug Office Add-ins on iPad and Mac

  3. OfficeDev/script-lab(使用 Angular 的 OSS Word/Ppt/Excel 插件)

【讨论】:

  • 感谢您的建议。我在 Mac 上的 Outlook 中使用控制台日志消息编辑了问题。这些日志消息仅在 Outlook mac 中显示。
  • 我收到错误提示 Office.js 尚未完全加载。请稍后再试或确保在 Office.initialize 函数中添加您的初始化代码。我用 main.ts 文件更新了问题。
猜你喜欢
  • 1970-01-01
  • 2017-07-24
  • 2017-12-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多