Using Ionic 4, and I’m trying to show a div only if two conditions are met:
<div *ngIf="variable1 === 1 && variable2 === 2">***</div>
That doesn’t work.
This works for just one variable though:
<div *ngIf="variable1 === 1">***</div>
I don’t imagine anyone has any tips?
export class HomePage {
variable1 = 0;
variable2 = 0;
}
<ion-list>
<ion-item>
<ion-label>variable 1</ion-label>
<ion-input [ngModel]="variable1" (ngModelChange)="variable1 = +$event"></ion-input>
</ion-item>
<ion-item>
<ion-label>variable 2</ion-label>
<ion-input [ngModel]="variable2" (ngModelChange)="variable2 = +$event"></ion-input>
</ion-item>
<ion-item *ngIf="variable1 === 1 && variable2 === 2">
<ion-label>achievement unlocked</ion-label>
</ion-item>
</ion-list>
If I type “1” into the variable 1 input, and “2” into the variable 2 input, I see “achievement unlocked”. Do you?