-1

I would like that my icon would only be visible if my array[0] = 'Value' :

HTML

<ion-icon *ngIf="allFamily[0] = 'Value'" class="checkas" name="checkmark"></ion-icon>

TS

allFamily = [
    {0: 'Value'}
]

But this isn't working, it shows ion-icon all the time. Note that 0: 'Value' I am adding after ion-icon shows up.

Anshuman Jaiswal
  • 5,352
  • 1
  • 29
  • 46
Angulandy2
  • 786
  • 4
  • 13
  • 31

2 Answers2

2

You should use == for comparison not =

<ion-icon *ngIf="allFamily[0] == 'Value'" class="checkas" name="checkmark"></ion-icon>
Anshuman Jaiswal
  • 5,352
  • 1
  • 29
  • 46
1

You need === to check equality = is for assignment,

<ion-icon *ngIf="allFamily[0] ==='Value'" class="checkas" name="checkmark"></ion-icon>
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396