[英]Cannot set property ɵfac after Angular update to latest v13
I updated the project via ng update from CLI@13.0.0 and Core@13.2.5 to the latest v13 minor releases (CLI@13.3.8 / Core@13.3.11 ).我通过 ng update 从CLI@13.0.0和Core@13.2.5将项目更新到最新的 v13 次要版本(CLI@13.3.8 / Core@13.3.11 )。
Since the update I got following error in the web console:自更新以来,我在 Web 控制台中收到以下错误:
table.component.ts:231 Uncaught TypeError: Cannot set property ɵfac of class BaseComponent {
constructor(injector) {
this.store = injector.get(_ngxs_store__...<omitted>...}
which has only a getter
at 7857 (table.component.ts:231:2)
at __webpack_require__ (bootstrap:19:1)
at 32552 (message.service.ts:18:31)
at __webpack_require__ (bootstrap:19:1)
at 21658 (auth.service.ts:6:21)
at __webpack_require__ (bootstrap:19:1)
at 197 (dialog.service.ts:31:32)
at __webpack_require__ (bootstrap:19:1)
at 47819 (route-not-found.component.html:13:5)
at __webpack_require__ (bootstrap:19:1)
at 98698 (menu-routing.module.ts:86:25)
at __webpack_require__ (bootstrap:19:1)
at 13785 (menu.module.ts:12:68)
at __webpack_require__ (bootstrap:19:1)
at 60796 (app.component.ts:30:26)
The component itself is an abstract BaseComponent used to be extended, the DI is managed by passing the Injector to the super constructor.组件本身是一个用于扩展的抽象 BaseComponent,DI 是通过将 Injector 传递给超级构造函数来管理的。
I already researched and came across Angular 9 production error: Cannot set property ɵfac of (abstract) class MyFilter { } which has only a getter我已经研究并遇到了Angular 9 生产错误:Cannot set property ɵfac of (abstract) class MyFilter { } which has only a getter
Removing the @Component Tag removes the error but why shouldn't it work anymore?删除@Component标记会删除错误,但为什么它不再起作用了? Furthermore after removing the tag another error appears in the console (I'm using NGXS@3.7.3 and note that the NGX-Store worked before, no code change in between)
此外,删除标签后,控制台中会出现另一个错误(我使用的是NGXS@3.7.3并注意 NGX-Store 之前工作过,两者之间没有代码更改)
core.mjs:6494 ERROR Error: You have forgotten to import the NGXS module!
at throwSelectFactoryNotConnectedError (ngxs-store.js:73:1) [angular]
at createSelectObservableIvy (ngxs-store.js:3844:1) [angular]
at createSelectObservable (ngxs-store.js:3800:1) [angular]
at dev/vendor.js:86124:36 [angular]
at doInnerSub (mergeInternals.js:19:18) [angular]
at outerNext (mergeInternals.js:14:1) [angular]
at OperatorSubscriber._next (OperatorSubscriber.js:13:1) [angular]
at OperatorSubscriber.next (Subscriber.js:31:1) [angular]
at ReplaySubject._subscribe (ReplaySubject.js:31:1) [angular]
at ReplaySubject._trySubscribe (Observable.js:37:1) [angular]
at ReplaySubject._trySubscribe (Subject.js:74:1) [angular]
at dev/vendor.js:98953:30 [angular]
at errorContext (errorContext.js:19:1) [angular]
at ReplaySubject.subscribe (Observable.js:22:21) [angular]
Anyone got an idea?有人有想法吗? I'm stuck on this.
我坚持这一点。 Thank you!
谢谢!
I found a solution:我找到了一个解决方案:
the @Select Tags from the ngxs/store seem to be conflicting. ngxs/store 中的 @Select 标签似乎有冲突。 When replacing them with select functions from the store the BaseComponents work fine!
当用商店中的选择功能替换它们时,BaseComponents 工作正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.