<form [formGroup]="objForm" (ngSubmit)="submit()">
<label formArrayName="orders" *ngFor="let order of getOrdersArray.controls; let i = index">
<input type="checkbox" [formControlName]="i">
{{ordersData[i].name}}
</label>
<button>submit</button>
</form>
This code works.
I want to understand since formGroup
and formControlName
are wrapped in []
(rectangular brackets), why is formArrayName
not wrapped in []?
I didn't find any explanation in this page: https://angular.io/guide/reactive-forms
Please explain the reasoning behind that syntax.