4

I'm trying to use Persian Jalali DatePicker for Angular Material in my project. So far, I have installed the package:

npm i --save @angular-persian/material-date-picker

But when I try to import it in my Angular project like so,

import {MatDatepickerModulePersian} from '@angular-persian/material-date-picker';

I get the following error:

Cannot find module '@angular-persian/material-date-picker' or its corresponding type declarations.

Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
Newsha Nik
  • 806
  • 2
  • 12
  • 29
  • The pre-requisites are all installed,right? Have you ng served the app after installing it? – Wahab Shah Jul 06 '20 at 13:39
  • @WahabShah yes, I just ng served it but I'm still getting the `cannot find module '@angular-persian/material-date-picker'.` error. – Newsha Nik Jul 07 '20 at 06:23
  • The compiler can't resolve the module. Look at *node_modules* folder in order to check the module structure then employ adoptive strategy to help typescript find it based on your environment configuration. – Amirhossein Mehrvarzi Jul 08 '20 at 15:08
  • @NewshaNik Please explain how it solved. – Khalil Laleh Jul 12 '20 at 08:07
  • Actually @KhalilLaleh I was mistaken. It is not fixed. – Newsha Nik Jul 12 '20 at 13:34
  • @AmirhosseinMehrvarzi unfortunately it didn't help. I looked at the node_modules folder and saw that I was actually giving the correct path. So... I don't really know what else I need to do. – Newsha Nik Jul 12 '20 at 13:34
  • Did you solve the problem? I have never used that dependency. Sometimes you have to do some handy tricks in *node_modules*. So don't rely on package managers (e.g `npm`) to do the best. Sometimes, prior versions may work better. So be innovative in such this time consuming cases. – Amirhossein Mehrvarzi Jul 19 '20 at 17:01
  • @AmirhosseinMehrvarzi no I didn't. I decided to use the ng-persian-datepicker instead and that worked fine for me. So I stuck with that. – Newsha Nik Jul 20 '20 at 07:40

1 Answers1

4

You just need to add "/src" to end of import

import {MatDatepickerModulePersian} from '@angular-persian/material-date-picker/src';

masoudvrz
  • 41
  • 2