简体   繁体   English

Angular 输入字段的日期选择器缺点

[英]Angular datepicker downside of input field

When i tried to open angular material datepicker it was opening upside of an input field.当我试图打开 angular 材料日期选择器时,它打开了输入字段的上方。 How to make it to open downside of an input field.如何让它打开输入字段的下行。

<mat-form-field appearance="outline" class="w-100 date-class">
          <mat-label class="required">End Date</mat-label>
          <input
            matInput
            [matDatepicker]="picker2"
            (dateChange)="onEndDateChange($event)"
            [min]="todayDate"
            formControlName="toDate"
            readonly
          />
          <mat-datepicker-toggle matPrefix [for]="picker2"></mat-datepicker-toggle>
          <mat-datepicker #picker2 yPosition="below"></mat-datepicker>
</mat-form-field>

If you want to control where the drop will be places you couls use parameters like: DatepickerDropdownPositionX, DatepickerDropdownPositionY ( https://material.angular.io/components/datepicker/api )如果您想控制放置的位置,您可以使用以下参数:DatepickerDropdownPositionX、DatepickerDropdownPositionY ( https://material.angular.io/components/datepicker/api )

 type DatepickerDropdownPositionY = 'above' | 'below';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM