How better to pass the ngModel in a variety of controls displayed cycle?

Learn Angular, please tell me:

Here I have a list of banks grouped by cycle
<div *ngfor="let item of banks; let i = index" class="col-md-6"> 
<mat-form-field>
 <mat-select placeholder="Status bakno {{item.name}}">
 <mat-option *ngfor="let item of bankStatuses" [value]="item.id">
 {{ item.name }}
</mat option>
</mat-select>
</mat-form-field>
 </div>


For each Bank it is necessary to set the status.

How best to define [(ngModel)] for mat-select (drop-down list of status)?
To get the array and index to make idisco Bank? Or are there any good practices?
June 5th 19 at 21:04
1 answer
June 5th 19 at 21:06
To get the array and index to make idisco Bank?

Why such complexity? You already have an array - the list of banks. Make the status property of the Bank. Ie, will something like this:

<mat-select [(ngmodel)]="item.status" placeholder="Status bakno {{item.name}}"></mat-select>

No, not suitable.
It is a form of customer edit. Each client has a set of statuses of the banks. Many-to-many.
And banks is simply the reference banks. - brendon78 commented on June 5th 19 at 21:09
well then, Yes, you can, as you yourself would like - not an array and the object. Will be something like this:
[(ngModel)]="client.bankStatuses[bank.id]" - favian_Torp12 commented on June 5th 19 at 21:12

Find more questions by tags AngularTypeScript