【发布时间】:2017-04-13 03:46:06
【问题描述】:
我有一种情况,我需要在同一个元素上使用 *ngIf 和 *ngFor 指令。我在 stackoverlow 上找到了很多答案,但没有针对这种情况的答案。
我有一个表格,我在其中循环遍历对象数组并在标题中动态写入单元格:
<table border="1" width="100%">
<thead>
<tr>
<td *ngFor="let item of headerItems" *ngIf="item.visible">{{ item?.name }}</td>
</tr>
</thead>
<tbody>
...
</tbody>
</table>
如果对象包含可见设置为真,我想显示/隐藏。我怎样才能做到这一点?
【问题讨论】:
标签: angular angular2-directives