jeudi 30 novembre 2023

I want to deselect the checkboxes on button click

i want to implement clear all filters feature, for that i need to deselect all the checkboxes on a button click.

I have used primeng checkbox. HTML:

<button (click)="clearAllFilters()">Clear All Filters</button>

<p-checkbox *ngFor="let cb of filterColorCheckboxes" value=""
    label="" (onChange)="checkBoxFilter(cb.category, cb.value, $event)">
</p-checkbox>

In event.checked, i am getting an array of length 1 containing the value of the checkbox (instead of any boolean value that is given in many other solutions). That's why am unable to deselect the checkbox.




Aucun commentaire:

Enregistrer un commentaire