在我的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>
我该怎么做才能渲染每个组件?
您无法从数组渲染组件,而是需要查看动态组件生成器