【发布时间】:2019-02-05 18:29:26
【问题描述】:
【问题讨论】:
【问题讨论】:
只需添加这个:
selectedCustomer = '01';
并且在模板中使用[(ngModel)]:
<div class="main-div">
<h3>List</h3>
<mat-form-field>
<mat-select
placeholder="Select Customer"
[(ngModel)]="selectedCustomer">
<mat-option
*ngFor="let customer of customers"
[value]="customer.id"
(click)="selected($event, customer.id)">
{{customer.name}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
这里有一个Working Sample StackBlitz 供您参考。
【讨论】: