0
我有这对我来说会返回一些值的数据库:插入图标,如果变量值为true
id
:整数nome
:串status
:布尔
仅当status
变量的值为true
时,我才想显示该项目。
见我HTML:
<ion-list ion-item *ngFor="let item of itens">
<ion-item >
<ion-label>{{ item.name }}</ion-label>
<ion-icon name="checkmark" color="secondary" item-right></ion-icon>
</ion-item>
</ion-list>
上述这种方式显示所有项目的图标。
如何才能插入图标只有当status
变量的值是true
?
使用* ngIf。 https://angular.io/docs/ts/latest/api/common/index/NgIf-directive.html –