title: Cannot read property '0' of undefined- Angular 6
body: <p>I have 2 nested NgFor loops, and I need to access value from them but when I try to do with ngModel and Index, it throws the error. </p>
  
  <p>following is the html for it: </p>
  
  <pre><code>&lt;tbody class="tb-space" *ngFor="let rate of
       rankingunitConfig.ratingLevels; let i=index;"&gt;
      &lt;tr&gt;
          &lt;td class="text-center sticky-child"&gt;{{rate.levelNo}}&lt;/td&gt;
          &lt;td class="text-center sticky-child"&gt;{{rate.fromPoint}}&lt;/td&gt;
          &lt;td class="text-center sticky-child"&gt;{{rate.toPoint}}&lt;/td&gt;
          &lt;ng-container *ngFor="let cal of populateScoreConfigTable; let j=index;"&gt;
              &lt;td class="text-center"&gt;
                  &lt;input type="text" class="form-control" placeholder="From score" [(ngModel)]="targetArray[i][j]"&gt;
              &lt;/td&gt;
              &lt;td class="text-center"&gt;
                  &lt;input type="text" class="form-control" placeholder="To score"&gt;
              &lt;/td&gt;
          &lt;/ng-container&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>Can anyone tell me how can I resolve this ? I think my array is going empty in ngModel but when I try to populate it, it gives same error. </p>