错误对象使用angular2材质日期选择器的对象

时间:2018-10-12 13:52:35

标签: object datepicker material

我在使用日期选择器和Angular2材质时遇到问题。

当我尝试使用此控件时,出现此错误:

ERROR Error: "[object Object]"

我在app_module上完成了引用,我从官方资料网站Date Picker Examples Angular Material中获取了原始代码。

   <mat-form-field class="example-full-width">
      <input matInput [matDatepickerFilter]="myFilter" [matDatepicker]="picker" placeholder="Choose a date">
      <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
      <mat-datepicker #picker></mat-datepicker>
    </mat-form-field>
    

1 个答案:

答案 0 :(得分:6)

我有同样的问题。我试图重现并得到错误: 错误:“ MatDatepicker:未找到DateAdapter提供程序 记录在https://material.angular.io/components/datepicker/overview#choosing-a-date-implementation-and-date-format-settings 将MatNativeDateModule添加到材料导入的模块对我来说很有效。