Answers for "check uncheck all checkbox angular"

0

uncheck all checkboxes typescript

html
<input #checkboxes type="checkbox">
...
<button type="button" (click)="uncheckAll()"></button>

ts file
@ViewChildren("checkboxes") checkboxes: QueryList<ElementRef>;

uncheckAll() {
  this.checkboxes.forEach((element) => {
    element.nativeElement.checked = false;
  });
}
Posted by: Guest on April-05-2021
-1

select all checkbox in angular

Prepared a small demo to show how this can be done using ngModel directive. Link: https://stackblitz.com/edit/angular-lxjrdh

It uses Array.every to check if all are checked or not. If checked, it resets all otherwise checks all.
Posted by: Guest on March-12-2021

Code answers related to "check uncheck all checkbox angular"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language