0

I have a form tag which wraps a component which contains different input fields.

<form #myForm="ngForm">
    <component-with-input-fields></component-with-input-fields>
</form>
{{myForm.value | json}}

Each input fields have ngModel directive attached but when i tried accessing myForm.value it just outputs {}.

Here is a sample of markup of component-with-input-fields:

<ng-container *ngFor="let attr of attributes">
    <input type="text" name="attr{{attr.attribute_id}}" ngModel>
</ng-container>

NOTE that the input fields and its name are dynamic.

Is there another way of getting the form values?

PrinceG
  • 982
  • 6
  • 17

0 Answers0