Cannot compare value using ngIf

I’m trying to compare values using ngIf and only show the div when it’s true. However, I cannot seem to solve this.

.TS code:

constructor(public navCtrl: NavController, public navParams: NavParams, public dp: DatabaseProvider) {

  	this.walletId = navParams.get('wallet_id');
    this.walletName = navParams.get('name');
  	
  }

HTML code:

<ion-list>
<ion-item *ngFor="let item of histories" text-wrap>
<div *ngIf="item.wallet_id == [walletId]">
	  <p>Some content here</p>
</div>
 </ion-item>
</ion-list>

Thank you!

Why do you have walletId in the square brackets?

Well, I have tried to use

{{ walletId }}

and still it doesn’t work.

No need to use interpolation here.

Simply doing the following should work

*ngIf="item.wallet_id == walletId"
2 Likes