Getting Error: 'mat-date-range-picker-actions' is not a known element

2.6k Views Asked by At

I want to add action buttons in my material date range picker. So i added this code given in documentation on link below

Documentation link: Date picker actions

<mat-date-range-picker #picker [touchUi]="true"> <mat-date-range-picker-actions> <button mat-button matDateRangePickerCancel>Cancel</button> <button mat-raised-button color="primary" matDateRangePickerApply> Apply </button> </mat-date-range-picker-actions> </mat-date-range-picker>

But when i run application i am getting error: 'mat-date-range-picker-actions' is not a known element

I have also imported MatDatepickerModule and MatNativeDateModule still getting this error. Without action buttons it is working fine,

1

There are 1 best solutions below

1
On

Got it working after updating Angular material version. Since date-picker-action-buttons were added in version 11.1.0 and i was using version 10.2.2

It working after updating material version using these commands

npm install @angular/cdk@latest
npm install @angular/material@latest
npm install @angular/material-moment-adapter@latest