【发布时间】:2020-07-02 10:32:47
【问题描述】:
我有一个垫选择。当我第一次显示表单时,我希望它在加载数据后选择选择中的第一项。我该怎么做?
<mat-select
placeholder="period"
(selectionChange)="selectperiod($event)"
(ngModel)="(periodoptions)"
>
<mat-option
*ngFor="let p of periodoptions | async"
[value]="p.periodid"
>
{{ p.periodstart }}
</mat-option>
</mat-select>
使用 this 调用函数来提取剩余数据
of(this.getperiods()).subscribe(pp => {
this.periodoptions = pp;
【问题讨论】:
-
我认为你应该看看这个答案。 stackoverflow.com/questions/50650790/…