[英]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.