【发布时间】:2017-12-15 05:18:15
【问题描述】:
我需要在 IE11 上使用纯 JavaScript 中的 Angular 4+。我的整个应用程序是OfficeJS add-in,即使用Dialog API 从我的加载项打开一个新窗口(IE11)。有几个限制:
- 必须在 IE11 上运行。
- 必须使用纯 JavaScript(我不能使用 TypeScript)。
- 在自己的上下文中运行。 Reference
- 必须尽可能轻量级(所以我不能让它重新初始化/引导我的整个 Angular 应用程序。Reference)。将对话框视为它自己的迷你应用。
我有 tried following these great examples,但无法启动 Angular。
我在 IE11 上遇到的错误是:
Object doesn't support property or method 'Class' (app.component.js (7,3))
Object doesn't support property or method 'Class' (app.module.js (7,3))
No NgModule metadata found for 'undefined'. (compiler.umd.min.js (55,26076))
在 Chrome 上(查看 Plunker 时)我收到以下错误:
app.component.js:11 Uncaught TypeError: Component(...).Class is not a function
at window.app.window.app (VM524 app.component.js:11)
at VM524 app.component.js:15
window.app.window.app @ app.component.js:11
(anonymous) @ app.component.js:15
app.module.js:13 Uncaught TypeError: NgModule(...).Class is not a function
at window.app.window.app (VM525 app.module.js:13)
at VM525 app.module.js:16
window.app.window.app @ app.module.js:13
(anonymous) @ app.module.js:16
compiler.umd.min.js:sourcemap:55 Uncaught Error: No NgModule metadata found for 'undefined'.
at NgModuleResolver.resolve (VM475 compiler.umd.min.js:55)
at CompileMetadataResolver.getNgModuleMetadata (VM475 compiler.umd.min.js:53)
at JitCompiler._loadModules (VM475 compiler.umd.min.js:62)
at JitCompiler._compileModuleAndComponents (VM475 compiler.umd.min.js:62)
at JitCompiler.compileModuleAsync (VM475 compiler.umd.min.js:62)
at CompilerImpl.compileModuleAsync (VM476 platform-browser-dynamic.umd.min.js:6)
at PlatformRef.bootstrapModule (VM472 core.umd.min.js:113)
at window.app.window.app ((index):42)
at (index):44
NgModuleResolver.resolve @ compiler.umd.min.js:sourcemap:55
CompileMetadataResolver.getNgModuleMetadata @ compiler.umd.min.js:sourcemap:53
JitCompiler._loadModules @ compiler.umd.min.js:sourcemap:62
JitCompiler._compileModuleAndComponents @ compiler.umd.min.js:sourcemap:62
JitCompiler.compileModuleAsync @ compiler.umd.min.js:sourcemap:62
CompilerImpl.compileModuleAsync @ platform-browser-dynamic.umd.min.js:sourcemap:6
PlatformRef.bootstrapModule @ core.umd.min.js:sourcemap:113
window.app.window.app @ (index):42
(anonymous) @ (index):44
我做错了什么?
如果可以使用 AOT 解决此问题,则可获得奖励积分(即在运行时不支付 JIT 成本)。
【问题讨论】:
-
为什么要在纯js中使用?是IE11的原因吗?
-
@Ludwig 我已经编辑了我的问题并添加了更多上下文。
标签: javascript angular internet-explorer-11 office-js