angular - 应用程序在卸载状态下死亡:无法读取未定义的属性“注入器”
问题描述
我正在使用 Single-Spa-Angular 库构建微前端。我使用“ng add single-spa-angular”创建了三个不同的子应用程序,其中两个应用程序运行良好,但一个应用程序显示以下错误:
Uncaught app2: Application 'app2' died in status UNMOUNTING: Cannot read property 'injector' of undefined
at http://<HOSTNAME>:4202/main.js:204363:53
和
Uncaught app2: Application 'app2' died in status SKIP_BECAUSE_BROKEN: In this configuration Angular requires Zone.js
at new NgZone (http://<HOST>:4202/main.js:68725:19)
at getNgZone (http://<HOST>:4202/main.js:69414:13)
at PlatformRef../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModuleFactory (http://<HOST>:4202/main.js:69312:22)
at http://<HOST>:4202/main.js:69356:59
谁能帮我吗。
感谢 Shashi Bhushan Verma
解决方案
我面临着同样的问题。在 main.single-spa.ts 文件中添加以下行:
导入'zone.js/dist/zone';
这似乎对我有用。
推荐阅读
- gams-math - 将 GAMS 结果写入文本文件
- android - 尽管没有使用双变量,但出现无效的双异常
- unity3d - 统一突出显示网格布局中的选定单元格
- python - 如何使用 python 正则表达式库从字符串中查找日期和时间?
- c# - 以发布模式发布 asp.net web 应用程序
- javascript - indexNew.html:140 未捕获的类型错误:无法在 HTMLImageElement.onclick (indexNew.html:140) 处设置 null 的属性“innerHTML”
- php - Symfony 4 使用用户实体的基本 http 身份验证
- docker - 使用多个注册表的 Docker 守护进程
- c# - 如何使用 JavaScriptSerializer 解析具有多个嵌套的 json 数组
- git - 如何让我的客户查看网站的不同分支