i originally found this question, which is really similar to my situation:
how to uncheck/check a primeng checkbox manually
and this is a StackBlitz where it shows my problem:
https://stackblitz.com/edit/angular-primeng-p-checkbox-issue-6xjv8b?file=app/app.component.ts
basically, i am looping through data that can be any length and displaying it in a table.
one of the columns just has a p-checkbox with (onChange), that when checked and unchecked, it passes in some parameters for me to keep track of in an array.
i am trying to then uncheck all the p-checkboxes with a button click.
i found another question/solution that mentioned using @ViewChildren, ElementRef, QueryList but it was having a problem trying to figure out what "nativeElement.checked" was.
and other questions/solutions i found involved knowing the length of the checkboxes beforehand, and using *ngFor through an array to display the correct amount of checkboxes. i tried to use similar logic with my setup, but couldn't get it working either.
Aucun commentaire:
Enregistrer un commentaire