-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,139
  • 1
  • 28
  • 46
Angulandy2
  • 716
  • 2
  • 13
  • 28

2 Answers2

2

You should use == for comparison not =

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

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

<ion-icon *ngIf="allFamily[0] ==='Value'" class="checkas" name="checkmark"></ion-icon>
Sajeetharan
  • 203,447
  • 57
  • 330
  • 376