[英]Calling Components in NgFor - Angular
我正在尝试在ngFor中调用动态组件,但是我不能在Tag HTML中使用变量。
我有的:
components = [component1, component2, component3];
<div *ngFor="let component of components">
<component></component>
</div>
结果我想要:
<component1></component1>
<component2></component2>
<component3></component3>
结果我得到:
<component></component>
<component></component>
<component></component>
您将无法那样做。 您必须使用组件加载器:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.