您好,我正在用带角材料的日期选择器创建一个表单。
但是当我单击“日期选择器”时,日历无法正确显示。
这是快照
HTML是
<div class="mat-elevation-z8">
<form [formGroup]="paymentFormGroup">
<mat-form-field class="form">
<input matInput formControlName="userId" placeholder="User Id">
</mat-form-field>
<mat-form-field class="form">
<mat-select formControlName="paymentType" placeholder="Type">
<mat-option *ngFor="let payment of paymentTypes" [value]="payment.value">
{{payment.viewValue}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form">
<input matInput [matDatepicker]="from" formControlName="fromDate" placeholder="From">
<mat-datepicker-toggle matSuffix [for]="from"></mat-datepicker-toggle>
<mat-datepicker #from></mat-datepicker>
</mat-form-field>
<mat-form-field class="form">
<input matInput [matDatepicker]="to" formControlName="toDate" placeholder="To">
<mat-datepicker-toggle matSuffix [for]="to"></mat-datepicker-toggle>
<mat-datepicker #to></mat-datepicker>
</mat-form-field>
<button class="form" mat-raised-button color="primary"> Submit </button>
</form>
</div>
请纠正我哪里出错了。
日历弹出窗口应该在表单字段的下方可见。