"How to set the DatePicker in Angular Matrial 7 ? Input Tag getting hide ?"

"How to set the DatePicker in Angular Matrial 7 ? Input Tag getting hide ?"

我正在使用 Angular Material 并面临管理 DatePicker 组件的问题,因为它正在隐藏输入框,因此日期不在输入标签的值中。

 <input matInput [matDatepicker]="picker1" placeholder="Anniversary">

 <mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>

 <mat-datepicker #picker1> </mat-datepicker>

我想你不见了<mat-form-field>。尝试这样做:

<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>