我正在使用Angular处理Outlook加载项。我在Outlook for Windows中收到一个错误,即加载索引页后组件未加载。使用Chrome和Firefox的Outlook Web App不会发生这种情况。
错误信息是:
SCRIPT5022: Office.js has not been fully loaded yet. Please try again
later or make sure to add your initialization code on the Office.initialize function.
polyfills.bundle.js (2741,25)
这是我的index.ts
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import * as $ from 'jquery';
declare let Office:any;
function launch() {
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule)
.then((success: any) => {
console.log('SampleAddin: bootstrap success', success);
})
.catch((error: any) => {
console.log('SampleAddin: bootstrap error', error);
});
}
Office.initialize = reason => {
console.log('Office intialize.....');
$(document).ready(function () {
if (environment.production) {
enableProdMode();
}
launch();
});
}
答案 0 :(得分:2)
回答我自己的问题:我无法在outlook mac和windows中加载组件。但在将此添加到polyfills.ts后:
import 'core-js/client/shim';
它也在IE 11中工作,似乎这并没有打破其他浏览器。