Can't bind to 'rangePicker' since it isn't a known property of 'mat-date-range-input'

Maruthi Eranki picture Maruthi Eranki · Jul 1, 2020 · Viewed 6.9k times · Source

I'm using angular date range picker and getting a issue:

Can't bind to 'rangePicker' since it isn't a known property of 'mat-date-range-input'.

  1. If 'mat-date-range-input' is an Angular component and it has 'rangePicker' input, then verify that it is part of this module.
  2. If 'mat-date-range-input' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

I have added imports, exports, providers in app.module.ts too:

imports: [
    MatNativeDateModule,
    MatDatepickerModule,
    FormsModule,
    ReactiveFormsModule
],
exports:[
  MatDatepickerModule,
  MatNativeDateModule
],
providers: [
  MatDatepickerModule,
  MatNativeDateModule,
]

date range picker in html:

<mat-form-field appearance="fill">
        <mat-label>Enter a date range</mat-label>
        <mat-date-range-input [rangePicker]="picker">
            <input matStartDate placeholder="Start date">
            <input matEndDate placeholder="End date">
        </mat-date-range-input>
        <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
        <mat-date-range-picker #picker></mat-date-range-picker>
</mat-form-field>

Should I add any thing else in module.ts?

Answer

Mykola Novytskyi picture Mykola Novytskyi · Jul 16, 2020

As I understand you have to have @angular/material": "^10.0.2 - not older