#mat-checkbox and formGroup

3 messages · Page 1 of 1 (latest)

hoary mountain
#

How do I hook up a <mat-checkbox> to a reactive form?
This is my html: <mat-checkbox [formGroup]="formGroup" formGroupName="active" name="active">Active</mat-checkbox>

#

Oh duh I needed to use formControlName.

silk jasper
#

Setting formGroup and formGroupName doesn't really make sense.
Additionally, a mat-checkbox requires a plain FormControl, not a whole group. So you want to set formControl or formControlName (again, not both).