在我的app.component.ts中,我有一个带有元件标签的数组。
compData = ['app-component-one', 'app-component-two', 'app-component-three'];
然后在我的app.component.html中,我有这个:
<div *ngFor="let comps of compData">
// I tried this: {{comps}} but that will not render the components
</div>
我该如何做才能渲染每个组件?
您不能从数组中渲染组件,而是需要查看动态组件生成器
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句