mercredi 18 janvier 2023

how to hide/show div with primeng checkbox?

Simple question. I am trying to hide/show div in angular depending on the checkbox condition.

Currently, I am using primeng checkbox but my code does not work.. can anyone please advise me?

Here is the code I made:

<home.component.html>

<p-checkbox [(ngModel)]="showMe" [binary]="true"></p-checkbox>

<div *ngIf="showMe"> example </div>

<home.component.ts>

export class HomeComponent implements OnInit {

  showMe: boolean = false;

}

Should I consider using (onChange) in this case?




Aucun commentaire:

Enregistrer un commentaire