从数组循环渲染组件

Render Components from Array loop

在我的 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>

我该怎么做才能渲染每个组件?

无法从数组渲染组件,需要查看动态组件生成器

https://angular.io/guide/dynamic-component-loader