【发布时间】:2020-08-17 16:01:17
【问题描述】:
我发现这篇文章在输入之后选择时效果很好,但是如何在 matinput 之前将它与 mat-select 一起使用?一旦我切换顺序,组件就会变得不可用,每次在字段内单击都会触发选择。
Angular Material Input and select in one form field
我的叉子: https://stackblitz.com/edit/angular-6nqzf1-ox413y?file=app%2Fform-field-overview-example.html
<mat-form-field appearance="outline">
<mat-label>End Time</mat-label>
<mat-select name="ampm" class="ampm" [(ngModel)]="event.eampm">
<mat-option value="AM">AM</mat-option>
<mat-option value="PM">PM</mat-option>
</mat-select>
<input matInput type="time" placeholder="HH:MM" id="end_time_hour" [formControl]="timeFormControl">
</mat-form-field>
【问题讨论】:
-
谢谢,如果您将评论移至答案,我会接受。