title: Angular 6, how to update angular input field while looping?
body: <p>I am trying to generate dynamic number of <code>mat-form-field</code> inside a html page.</p>
  
  <p>I have the following data in component file: </p>
  
  <pre><code>data = [{
      'name': 'XYZ',
      'id': 1,
      'accNo': 123
    },
    {
      'name': 'ABC',
      'id': 2,
      'accNo': 456
    },
    {
      'name': 'PQR',
      'id': 3,
      'accNo': 567
    }
    ]
  </code></pre>
  
  <p>And in html, I am looping as follows:</p>
  
  <pre><code>&lt;div class="flex-container"&gt;
      &lt;div class="deposit-box" *ngFor="let c of data"&gt;
          &lt;div&gt;
              &lt;mat-form-field appearance="outline"&gt;
                  &lt;mat-label&gt;Name:&lt;/mat-label&gt;
                  &lt;input matInput placeholder="Placeholder" 
          [(ngModel)]=c.name&gt;
        &lt;/mat-form-field&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But I am facing problem in updating the value in <code>input</code> tag. only the first 
  <code>mat-form-field</code> is getting the value.</p>
  
  <p>Stackblitz: <a href="https://stackblitz.com/edit/angular-7a7add" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-7a7add</a></p>
  
  <p>Please help me. </p>
  
  <p>Currently I am getting output as:</p>
  
  <p><a href="https://i.stack.imgur.com/XTush.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XTush.png" alt="enter image description here"></a></p>