I'm filling a table with data from an array and I want to focus a custom input on the last element of the table, so I have this:
<tr *ngFor="let detail of detailsList; let i = index" (dblclick)="showDetailDetails(detail.ID, i)"> <th>{{ a few table fields}}</th> <th> <md-input-container> <input [focus]="detailsList.length-1 == i" mdInput type="number" (keypress)="qtKeyDown($event)" (change)="getTotalNetAmount(i)" [(ngModel)]="detail.OrderedQuantity" [ngModelOptions]="{standalone: true}" value="{{detail.OrderedQuantity}}" min="1" OnlyNumber="true" [disabled]="!editMode"> </md-input-container> </th> <th> (More fields) </th> </tr> It works as intended but when there is more than 1 item in the array I'm getting an error in my console. I notice that the problem is in this code:
detailsList.length-1 == i Is there anyway to fix this error? The Code is working as intended so this error don't bother the behavior the website, the problem is that I don't want the user to see errors in the browser console.