我正在跟踪这个职位,试图动态创建组件(基于json数据)-
但这段代码:
ngOnInit() { // Create our component now we're initialised let componentFactory = this.resolver.resolveComponentFactory(MyDynamicComponent); this.componentReference = this.dynamicTarget.createComponent(componentFactory); }
生成一个编译错误,名为metadata_resolver.js:508: Uncaught Error: Can't resolve all parameters for MyDynamicComponent: (?).
IDE提示:Argument type MyDynamicComponent is not assignable to parameter type Type<MyDynamicComponent>
我不知道我应该如何使用它并修改我的调用。陷阱是什么?
发布于 2022-06-05 15:27:17
目前版本的Ionic v6.1.8与角14不兼容。显然,它已经在开发版本中得到了修正,但还不稳定。请看这里的https://github.com/ionic-team/ionic-framework/issues/25353,您可以将@ionic/angular更新为6.1.9-dev.11654275237.1b595be3版本并重新运行npm install。如果你想站在边缘的话,现在应该工作得很好。
https://stackoverflow.com/questions/40250806
复制相似问题