title: Input value sticks when changing structure in angular 8 ngFor loop
body: <p>I am facing a weird issue in angular 8 ngFor loop. </p>
  
  <p>On click of update button, weeksValueDoubleArray changes but view is corrupted with old input data. When the run the application, I change the starting values from the input boxes, and then I click update button. However, the changed value before update sticks around even after update.
  <a href="https://i.stack.imgur.com/PnS8Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PnS8Z.png" alt="This is before editing text"></a></p>
  
  <p><a href="https://i.stack.imgur.com/fDsvm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fDsvm.png" alt="this is after editing text"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Z2Vfs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z2Vfs.png" alt="This is after clicking update button"></a>
  Here is the html code:</p>
  
  <pre><code>&lt;div class="table-responsive mb-4 mt-4"&gt;
    &lt;button (click)="update()"&gt;update&lt;/button&gt;
  
    &lt;table class="table table-bordered custom-table" id="mytable"&gt;
      &lt;tr id="headerRow"&gt;
        &lt;ng-container *ngFor="let wk of arrayOfWeeks;let i=index"&gt;
          &lt;th id="arrayWks{{i}}"&gt;{{wk}}&lt;/th&gt;
        &lt;/ng-container&gt;
      &lt;/tr&gt;
      &lt;ng-container id="ngId" *ngFor="let currSample of currentSamples;let in=index"&gt;
        &lt;tr&gt;
          &lt;ng-container *ngFor="let weekValue of weeksValueDoubleArray[in];let i=index"&gt;
            &lt;td&gt;
              &lt;input type="text" value={{weekValue}}&gt;
            &lt;/td&gt;
          &lt;/ng-container&gt;
        &lt;/tr&gt;
      &lt;/ng-container&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And the typescript code is below:</p>
  
  <pre><code>import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
  
  @Component({
    selector: 'app-test',
    templateUrl: './test.component.html',
    styleUrls: ['./test.component.css']
  })
  export class TestComponent implements OnInit {
    public currentSamples: string[];
    public arrayOfWeeks: string[];
    public weeksValueDoubleArray: string[][];
    public weeksValue: string[];
    constructor() { }
  
    ngOnInit() {
      this.currentSamples = new Array();
      this.currentSamples.push("0", "1", "2", "3", "4");
      this.populateWeeksValue();
      this.arrayOfWeeks = new Array();
      for (var i = 1; i &lt;= 54; i++) {
        if (i &lt; 10) {
          this.arrayOfWeeks.push("WW0" + String(i));
        }
        else {
          this.arrayOfWeeks.push("WW" + String(i));
        }
      }
    }
  
    update() {
      this.weeksValueDoubleArray = [];
      for (let ind = 0; ind &lt; this.currentSamples.length; ind++) {
        this.weeksValue = new Array();
        for (var i = 1; i &lt; 54; i++) {
          let value = "";
          if (i &gt; 31 &amp;&amp; i &lt; 40) {
            value = "yes";
          }
          this.weeksValue.push(value);
        }
        this.weeksValueDoubleArray.push(this.weeksValue);
      }
    }
    populateWeeksValue() {
      this.weeksValueDoubleArray = [];
      for (let ind = 0; ind &lt; this.currentSamples.length; ind++) {
        this.weeksValue = new Array();
        for (var i = 1; i &lt; 54; i++) {
          let value = "";
          if (i &gt; 21 &amp;&amp; i &lt; 30) {
            value = "yes";
          }
          this.weeksValue.push(value);
        }
        this.weeksValueDoubleArray.push(this.weeksValue);
      }
    }
  }
  </code></pre>