【问题标题】:angular material select and input inside the same field在同一字段内选择和输入角度材料
【发布时间】: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>

【问题讨论】:

标签: angular angular-material


【解决方案1】:

关注有关创建自定义表单字段控件的 angular-material 文档:Creating a custom form field control

【讨论】:

    猜你喜欢
    • 2019-06-02
    • 2020-08-01
    • 2017-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-18
    • 2020-02-06
    • 2021-09-27
    相关资源
    最近更新 更多