Angular Reactive Form with dynamic fields
问题 I'm currently battling with Angular form array. I have a form in which I add the fields dynamically. I have created the form object: this.otherDataForm = this.fb.group({ }); I add the dynamic fields like this: addField(field: CustomFormField): void { this.otherDataForm.addControl(id_campo, new FormControl('', Validators.required)); } I loop through those fields: <form *ngIf="selectedProfile" [formGroup]="otherDataForm"> <div class="mb-3" *ngFor="let field of fields; let i = index"> <label>{