Answer the question
In order to leave comments, you need to log in
How to avoid data display error in dropdown list in duplicated TDforms?
There is the following form:
<mat-input-container class="input-block">
<input matInput
placeholder="Количество"
name="number"
[(ngModel)]="count"
#number="ngModel"
(ngModelChange)="addForms()"
type="number">
</mat-input-container>
<mat-expansion-panel [expanded]="false" *ngFor="let title of titles; let i = index">
<mat-expansion-panel-header>
<mat-panel-title>Форма {{ i + 1 }}</mat-panel-title>
</mat-expansion-panel-header>
<mat-form-field class="input-block">
<mat-select placeholder="Наименование"
name="title{{i + 1}}"
#title="ngModel"
[(ngModel)]="title.model">
<ngx-mat-select-search name="modelFilterByTitle"
#modelFilterByTitle="ngModel"
ngModel></ngx-mat-select-search>
<mat-option *ngFor="let model of filteredModels$ | async" [value]="model">
{{model.name}}
</mat-option>
</mat-select>
</mat-form-field>
count: number;
titles = [];
addForms() {
this.titles = [];
for (let i = 1; i <= this.count; i++) {
this.titles.push({
model: modelModel,
});
}
}
Answer the question
In order to leave comments, you need to log in
Helped elsewhere, the answer was covered in compareWith https://v5.material.angular.io/components/select/api
Maybe it will come in handy for someone, I'll mark it as a solution.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question