【发布时间】:2019-05-08 21:58:32
【问题描述】:
我想知道是否有一种方法可以使用 ngFor 来渲染组件,例如 this link 中的代码
总结一下,我想做这样的事情
<div *ngFor="let item of tabs" class="tab-content" id="myTabContent">
<div
class="tab-pane fade show active"
[id]="item.tab"
role="tabpanel"
aria-labelledby="{{ item.tab }}-tab"
>
<app-{{item.tab}}></app-{{item.tab}}>
</div>
</div>
假设我已经创建了组件和 tabs 变量:
tabs = [
{ title: "Impresoras", tab: "printers" },
{ title: "Mapa de Ataques", tab: "attacks" },
{ title: "Alerta de Vuelos", tab: "flights" }
];
【问题讨论】:
标签: angular