ngIf with depending from number binding image in Angular 4
问题 <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> I am trying to display an image if my ".acknowledged" is returning "1" and if it return "0" nothing should be displayed...It works with a string but not with a number..I don't really understand why.. 回答1: You should be using *ngIf...else , as <ng