I want to use the DatePickerModule from Angular in my application. So I installed the package as follows: npm install ng2-datepicker-bootstrap --save
Installation was successful. So now I have imported the DatePickerModule module into my AppModule, as shown below:
import { DatePickerModule } from 'ng2-datepicker-bootstrap';
@NgModule({
declarations: [
other Components......,
DatePickerModule
],
imports: [
........
],
providers: [Service, DatePickerModule],
bootstrap: [AppComponent]
})
export class AppModule { }
Then use the code below in my info.component.html .
<datepicker [(ngModel)]="model.firstDate" [viewFormat]="'DD/MM/YYYY'" [modelFormat]="'YYYY-MM-DD'" [id]="'firstDate'" [label]="'To'"></datepicker>
But when I run the project, I got this error:
Error: unexpected module 'DatePickerModule' declared by the module 'AppModule'. Add a note @ Pipe / @ Directive / @ Component.
I am new to Angular2.