In my Angular application, I am trying to use angular4-datepicker. As they have mentioned in their documentation they are importing their module like this:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { MyTestApp } from './my-test-app';
import { MyDatePickerModule } from 'mydatepicker';
@NgModule({
imports: [ BrowserModule, MyDatePickerModule ],
declarations: [ MyTestApp ],
bootstrap: [ MyTestApp ]
})
export class MyTestAppModule {}
But when I am importing mydatepicker
like that I am getting an error:
Cannot find module 'mydatepicker'.
Instead I have to give path to the node module it self.
import { MyDatePickerModule } from '../../../../../node_modules/angular4-datepicker/src/my-date-picker';
How do I load that module like that they have mentioned in their documentation?
Using this syntax import { MyDatePickerModule } from 'mydatepicker';
means you have a module exported called mydatepicker. Typescript import/export official documentation.
Seems the error you are pointing has been reported on Github's repo: Github Date Picker issue and solutions
Hope this helps ;)