M
M
mletov2018-05-18 11:47:55
Angular
mletov, 2018-05-18 11:47:55

What is the best way to pass ngModel to a lot of controls output by a loop?

I am learning Angular, please tell me:
I have a list of banks output by a loop

<div *ngFor="let item of banks; let i = index" class="col-md-6">           
        <mat-form-field>
            <mat-select placeholder="Статус по бакну {{item.name}}">
                <mat-option *ngFor="let item of bankStatuses" [value]="item.id">
                    {{ item.name }}
                </mat-option>
            </mat-select>
        </mat-form-field>
    </div>

Each bank must be assigned a status.
What is the best way to set [(ngModel)] for mat-select (status dropdown)?
Create an array, and make the bank ID an index? Or are there any good practices?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question