, , , ReactiveFormsModule
. , FormControls.
initForm(): void {
this.Form = this._FormBuilder.group({
arrayOfInputs: this._FormBuilder.array(initArray())
})
}
initArray(): FormGroup[] {
return [
{ this._FormBuilder.group({ inputValue: [''] }),
{ this._FormBuilder.group({ inputValue: [''] }),
{ this._FormBuilder.group({ inputValue: [''] })
]
}
<ng-container formArrayName="formArray">
<div [formGroupName]="i" *ngFor="let Inputs of Form.get('arrayOfInputs').controls; let i=index">
<input formControlName="inputValue" type="text">
</div>
</ng-container>
- , , , , . , FormArray , -. .