【发布时间】:2018-07-09 14:06:58
【问题描述】:
在我的 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>
如何才能渲染每个组件?
【问题讨论】:
-
你试过
<{{comps}}></{{comps}}>吗? -
@JiiB,你真的认为它会起作用吗?
-
你不能那样做
-
@Qwertiy 不,我完全不确定。但通常你写你的组件标签就像一个正常的打开和关闭 html 标签
标签: angular typescript angular5