mercredi 30 janvier 2019

Angular | Programmatically set elements attribute

I'm utilizing Angular Material to create an awesome web application. Please consider the following code:

<mat-checkbox class="master" (click)='checkAll()'>Checkbox MASTER</mat-checkbox>
<mat-checkbox class="checkbox">Checkbox 2</mat-checkbox>
<mat-checkbox class="checkbox">Checkbox 3</mat-checkbox>

The code produces three checkboxes. When the first checkbox is checked, the two others should be checked as well. If the first checkbox is not checked, the two others should function normally.

In component:

checkAll() {
  // How can I programmatically set the [checked] property here for .checkbox?
}




Aucun commentaire:

Enregistrer un commentaire