title: Angular 6 - ngModel in ngFor is updating every item in array
body: <p>I started learning Angular 6 a couple weeks ago, so I'm still new to this.  </p>
  
  <p>I've been trying to update two-way bind fields in an array of objects.</p>
  
  <p>Here is my array initialized in </p>
  
  <p><strong>store.component.ts</strong>:</p>
  
  <pre><code>store_list = [{
      Address1: 'add1',
      Address2: 'test',
      City: ''
  },{Address1: 'aaaa',
      Address2: 'bbbb',
      City: 'cccc'}];
  
      trackStore(index: number, obj: any): any {
      return index;
  }
  </code></pre>
  
  <p><strong>store.component.html:</strong></p>
  
  <pre><code>&lt;div *ngFor="let store of store_list; let i=index; trackBy: trackStore;"&gt;
    &lt;mat-card class="store-card" mat-elevation-z8&gt;
       &lt;mat-card-content&gt;
        &lt;form class="example-form"&gt;
          &lt;mat-form-field class="address-street"&gt;
            &lt;input matInput [(ngModel)]="store_list[i].Address1" placeholder="Street Address" name="store.{{i}}.address1" required&gt;
          &lt;/mat-form-field&gt;            
          &lt;mat-form-field class="address-street"&gt;
            &lt;input matInput [(ngModel)]="store.Address2" placeholder="Address Line 2" name="store.{{i}}.address2" required&gt;
          &lt;/mat-form-field&gt;
         &lt;/form&gt;
       &lt;/mat-card-content&gt;
    &lt;/mat-card&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I tried binding two different ways to ngModel to see if either would work. They both behave the same way though.</p>
  
  <p>When I have an array of 3 stores and update Address 1 or Address 2 on ANY one of those stores, all 3 store Address 1 fields update.</p>
  
  <p>Most of the research online resulted in 3 solutions, none of which has worked so far.</p>
  
  <ol>
  <li>Include index in "name" attribute to have a unique field name.  </li>
  <li>Use trackBy, I also tried using a unique id in the store_list array and returning it through the custom trackBy function and it didn't work.  </li>
  <li>Don't use ngModel in ngFor.  </li>
  </ol>