I have the following code snippet:
vmarray[]={'Code','Name','Place','City'}
export class VMDetail {
lstrData1:string;
lstrData2:string;
lstrData3:string;
lstrData4:string;
lstrData5:string;
lstrData6:string;
lstrData7:string;
}
vm:VMDetail
<ng-container *ngFor="let datas of vmarray; let i = index;">
<mat-form-field class="example-full-width" [ngStyle]="ngStyleMapper(datas.width)">
<input [(ngModel)]="vm.lstrData{{i}}" name="vm.lstrData{{i}}" matInput placeholder ={{datas}} (click)="dblclick(i)">
</mat-form-field>
</ng-container>
I'm trying to figure out a way to dynamically define the ngModel name. Any suggestions on how to achieve this?