ng2-boostrap datePicker implementation error

696 views Asked by At

I implement ng2-bootstrap datePicker in my angular 2 app but faced some type of modules error and I do not understand what is the problem behind.Please help me.

module.ts

import { DatepickerModule } from 'ng2-bootstrap/datepicker';

 @NgModule({
  imports: [
  ...........  
  DatepickerModule
  ...........
  ],
  declarations: [
    .....
    .....
  ]
})
export default class Modules {
}

html file

<div>
    <datepicker></datepicker>
</div>

error

'datepicker' is not a known element:
1. If 'datepicker' is an Angular component, then verify that it is part of this module.
2. If 'datepicker' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("<div class="form-group"><div>
                          [ERROR ->]<datepicker></datepicker>
                          <!--<datepicker [expanded]="true" class="danger"-"): AddCustomer@49:26
Can't bind to 'expanded' since it isn't a known property of 'datepicker'. ("                              <div>
                                                    <datepicker [ERROR ->][expanded]="true" class="danger"
                                                                form"): AddCustomer@212:64
'datepicker' is not a known element:
1

There are 1 answers

0
federico scamuzzi On

have you include in your app.module.ts the lib of Boostrap? like this:

// ... other imports
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
// ... other imports


@NgModule({
    imports: [
        BrowserModule,
        routing,
        HttpModule,
        JsonpModule,
        ToasterModule,
        CoolHttpModule,
        SlimLoadingBarModule.forRoot(),
        NgbModule.forRoot() //need to be import also here
    ]