On a form I have two (or more) categories of controls (currently only checkboxes):
<form [formGroup]="form">
<div class="category 1">
<mat-checkbox formControlName="cb1">Checkbox 1</mat-checkbox>
<mat-checkbox formControlName="cb2">Checkbox 2</mat-checkbox>
</div>
<div class="category 2">
<mat-checkbox formControlName="cb11">Checkbox 11</mat-checkbox>
<mat-checkbox formControlName="cb12">Checkbox 12</mat-checkbox>
</div>
...
</form>
Depending on other actions on the form, I need to control state of a category, i.e. enable/disable and check/uncheck all the controls. So I need a way to effectively iterate over a category. Currently I came up with a solution based on this answer, but this requires maintaining lists of names for each category.
Is there nicer/easier way to iterate over my categories?