Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mat-date-range-input isn't known element [Angular material]

The problem is that I can't use <mat-date-range-input> Material Component because I get an error:

enter image description here

I have a module called "Material module" and there's an import and export of MatNativeDateModule and MatDatepickerModule. This module is imported into module I'm working with.

I can use simple mat-datepicker and it works properly.

Can anybody help me with that?

10.1.2 - version of Material

like image 277
Alexandre Adereyko Avatar asked Aug 05 '20 14:08

Alexandre Adereyko


1 Answers

Are you on an older version of Angular, but on version 10.1.2 of material?

mat-date-range-input doesn't work on Angular versions lower than 10.0.2. To take advantage of this, you have to update your application, this is pretty straightforward if you are on version 9. I faced the same issue and after updating the range date picker is working.

For detailed information of how to update go to: https://update.angular.io/.

These imports also have to be in the app.module.ts

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

Hope this helps. :)

like image 150
prateek upadhyay Avatar answered Oct 20 '22 21:10

prateek upadhyay