MyDatePickerModule is not an NgModule

1

I am using this module in angle 2 and this error is being presented, you can help me.

app.module.ts

import {MyDatePickerModule} from "mydatepicker";
@NgModule({
declarations: [
AppComponent,
TestComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
MyDatePickerModule,
MaterialModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}

test.component.ts

private myDatePickerOptions: IMyOptions = {
 dateFormat: 'yyyy-mm-dd',
 firstDayOfWeek: 'mo',
 sunHighlight: true,
 inline: false,
 width: '60%'
};

test.component.html

<my-date-picker [locale]="locale" class="card-size"    [options]="myDatePickerOptions"
                (dateChanged)="onDateChanged($event)">

</my-date-picker>
    
asked by Gdaimon 25.01.2017 в 05:13
source

2 answers

1

Use better:

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

and to use it in the template (HTML) is:

<label for="example-start-date" class="form-control-label">Fecha Inicio:</label>
<div class="card-block">
  <div id="example-start-date" style="display:inline-block; min-height:290px;">
    <datepicker [(ngModel)]="example.start_date" name="start_date" required></datepicker>
  </div>
</div>

You can check the following page: link

    
answered by 08.04.2017 в 05:25
0

It seems to be a bug in version 1.3.0 of mydatepicker. You have several options:

  • Wait for them to fix the bug and get an update, then update mydatepicker.

  • Use an earlier version that seems to work for some users: npm install [email protected]

  • Use an earlier version of angular-cli, which seems to compile correctly: npm install [email protected]

  • answered by 25.01.2017 в 11:28