<td *ngFor="let user of userService.users | async">
<div *ngIf="user?.data.apps.details[0].acknowledged as fooIcon">
<img *ngIf="fooIcon === "1" " src="./app/img/icones_sized/tick.png"/>
<img *ngIf="fooIcon === "0" " src="nothing_appears"/>
</div>
如果我的“.acknowledged”返回“1”,我试图显示图像,如果返回“0”,则不应显示任何内容......它适用于字符串但不带数字..我不是真的明白为什么..
答案 0 :(得分:1)
您应该使用 *ngIf...else
作为
<ng-template #loading>
<img src="./app/img/icones_sized/stable_arrow_small.png"/>
</ng-template>
<div *ngIf="user?.data.apps.details[0].acknowledged===1;else loading;">
<img src="./app/img/icones_sized/tick.png"/>
</div>