I have a table which dynamically constructs rows as follows
<form [formGroup]='employeeForm'>
<table class="table table-dark">
<thead>
<tr>
<th scope="col">name</th>
<th scope="col">contact details</th>
</tr>
</thead>
<tbody>
<tr *ngFor='let details of employeeDetails'>
<th formControlName='name' scope="row">{{details.name}}</th>
<td formControlName='employeeName'>{{details.contactDetails}}</td>
</tr>
</tbody>
</table>
</form>
now, how can i attach my dynamically created controls to the form? i tried this
employeeForm: FormGroup
constructor(private formbuilder: FormBuilder) { }
ngOnInit() {
this.employeeForm = this.formbuilder.array([])
}
but it is giving me error stating, the formGroup cannot contain formArray
how can i add my formArray into the formGroup using reactive form approach?