@dlim wrote:
Hi,
I would like to display ion-icon based from value retrieved from *ngFor.
Tried using *ngIf on ion-icon but it’s generating error.
<ion-list> <button ion-item (click)="getUsers()" *ngFor="let user of users" [navPush]="userPage" [navParams]="user"> <ion-icon *ngIf="user.category=='Admin'" name="XXX" item-left></ion-icon> <ion-icon *ngIf="user.category=='Contributor'" name="YYY" item-left></ion-icon> <h2>{{ user.first_name}}</h2> <p>{{ user.category}}</p> </button> </ion-list>
Here, it should display icon XXX if Category = ‘Admin’, else display icon YYY if Category=‘Contributor’
Any suggestion how to achieve this?
Posts: 1
Participants: 1