2

I have an Angular (4) application that generates a formGroup object in my application component. I want to dynamically add all these components in my template, it expected the following to work.

<form [formGroup]="updateValuesForm">
    <ng-container *ngFor="let control of updateValuesForm.controls">
      <input formControlName='control.name' type="text"/>
    </ng-container>
</form>

But that generates the following error:

Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.

Is it even possible to achieve this in Angular?

4

0 回答 0