title: Reference input ngModel to object in ngFor loop
body: <p>I am trying to generate dynamic form using the array. In that array I am providing the FieldLabel &amp; DataModel.
  Here I want to use DataModel as the object reference. I want to update the referenced model when user update the value in Input Field.
  I have searched a lot but not able to find the solution yet.</p>
  
  <p>Is there any other way to achieve what I want?</p>
  
  <p>I have tried Iterating the model and used the DataModel attribute in [(ngModel)] but it is taking that as a STRING (which is valid)  but I don't want this. I want to reference the main object instead of taking that as a string.</p>
  
  <pre><code>obj : any = {
        FirstName:"Taha",
        MiddleName:"Faheem",
        LastName:"Hussain",
        Address:
          {
            CurrentAddress:"USA",
            PermanentAddress:"Pakistan"
          }
    }
  
    fields: any[] = [
      {
        "FieldLabel": "First Name",
        "DataModel": "obj.FirstName"
      },
      {
        "FieldLabel": "Middle Name",
        "DataModel":"obj.MiddleName"
      },
      {
        "FieldLabel": "Current Address",
        "DataModel":"obj.Address.CurrentAddress"
      }  
    ];
  </code></pre>
  
  <pre><code>&lt;div class="container" fxLayout="column" fxLayoutGap="10px"&gt;
    &lt;div *ngFor="let field of fields"&gt;
      &lt;input placeholder="{{field.FieldLabel | uppercase}}" [(ngModel)]="field.DataModel"&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;input placeholder="Last Name" [(ngModel)]="obj.LastName"&gt;
    &lt;/div&gt;
    &lt;br&gt; {{obj|json}}
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to update the obj with the value user enter in ngFor input fields.</p>
  
  <p>I am working to generated the complete dynamic form along with the formula on each fields using this approach.
  Is there any better approach to get the desired result?</p>