How to check if a checkbox is checked?

Hello, I want to to show an element with *ngIf only if checkbox is checked, how please ?

 <ion-item>
    <ion-label>Pizza</ion-label>
    <ion-checkbox [(ngModel)]="checkboxpizza"></ion-checkbox>
  </ion-item>
<div *ngif="checkboxpizza>

pizza selected
</div>
1 Like

Thanks but It don’t work, I finaly succeeded like this :

<ion-checkbox (click)="toggleCheckbox()"></ion-checkbox>
<div *ngIf="showItem">
<div>
showItem: boolean;

toggleCheckbox() {
    this.showItem = !this.showItem;
  }
1 Like

You can change that to this.showItem = false.
It’s more in line with standards and drives home the fact that you can toggle bound booleans true/false to add and remove elements (and it keeps the variable in an actual boolean state)

You means

  toggleCheckbox() {
    this.showItem = false;
  }

?
It’s not work for me

Never mind then :slight_smile:

Buena men, tal cual lo q necesitaba…

hi it,s working for me *ngIf=‘lumber’
but if i want to use for two ngmodel *ngIf=‘lumber’ || =‘logs’ is not working for me…
please state how to ngif for two ngmodel