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-checkbox [(ngModel)]="checkboxpizza"></ion-checkbox>
<div *ngif="checkboxpizza>

pizza selected


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

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

toggleCheckbox() {
    this.showItem = !this.showItem;


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