【发布时间】:2019-08-14 10:25:18
【问题描述】:
想要在 mat-select 中显示一个字符串数组。该 mat-select 应将数据显示为预选(多个)格式。通过单击它,应显示选项,但不应进行任何更改。 mat-select 是 mat-table 条目的一部分,应该只是在 html-template-code 中定义的 view-cell(不应更改 table-data-source 的数据)。
以angular-material-select-documentation为例,但甚至无法让它显示数据,而无需手动选择。
<ng-container matColumnDef="letters">
<th mat-header-cell *matHeaderCellDef>Letters</th>
<td mat-cell *matCellDef="let data; let i = index;">
<mat-form-field>
<mat-label></mat-label>
<mat-select multiple [ngModel]="data.letters">
<mat-option *ngFor="let letter of data.letters" checked disabled>
{{letter}}
</mat-option>
</mat-select>
</mat-form-field>
</td>
</ng-container>
【问题讨论】:
标签: arrays angular drop-down-menu angular-material mat-table