Can't bind to 'matDatepicker' since it isn't a known property of 'input' - Angular

后端 未结 5 1757
死守一世寂寞
死守一世寂寞 2020-12-29 18:08

I have just copied and pasted angular material code for datePicker and input, but I am getting this error for the datePicker.

app.module



        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 18:51

    To use MatDatePicker in application add following line in your app.module.ts file:

    1. import MatDatepickerModule, MatNativeDateModule in you app.module.ts.

      For example:

      import { MatDatepickerModule, MatNativeDateModule } from '@angular/material';

    2. Add MatDatepickerModule, MatNativeDateModule uner @NgModule in imports and exports:

    **

    @NgModule ({
                imports: [
                    MatDatepickerModule,
            MatNativeDateModule 
                ],
                exports: [
                    MatDatepickerModule, 
                    MatNativeDateModule 
                ]
            })
    

    **

提交回复
热议问题