我正在使用@angular/material2 模块将日期选择器添加到我的 Angular 4 应用程序中。
这是我的HTML
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
应用程序模块.ts
import {MatDatepickerModule,MatNativeDateModule,MatFormFieldModule,MatInputModule} from '@angular/material';
当我点击日期选择器切换器时,日期选择器弹出窗口在页面的最后打开,完全在表单字段之外,它应该打开。
我们将不胜感激。
最佳答案
我的问题是我将 .mat-form-field-underline
设置为隐藏。日期选择器使用此元素来确定位置。
关于angular - @angular/material 日期选择器位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46746547/