Ion2-calendar - can't bind to ngModel (Ionic 4)

Does anyone know why I am getting the following error?
Does it not work with Ionic 4?
I am importing in my app.module:

import { CalendarModule } from 'ion2-calendar';
imports [
    ...
    CalendarModule
  ],
<ion-calendar [(ngModel)]="date"
              (change)="onChange($event)"
              [type]="type"
              disableDays=[1,2,3,4]
              [format]="'YYYY-MM-DD'">
</ion-calendar>

I’m getting the error:
Can’t bind to ‘ngModel’ since it isn’t a known property of ‘ion-calendar’.

  1. If ‘ion-calendar’ is an Angular component and it has ‘ngModel’ input, then verify that it is part of this module.
  2. If ‘ion-calendar’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
  3. To allow any property add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component

I just needed to add FormsModule to my App.module imports

Hi, I’m facing the same issue. can you explain your solution more specific

Like this:

@NgModule({
  declarations: [
    AppComponent
  ],
  entryComponents: [],
  imports: [
   .... other imports,
    FormsModule
  ],
1 Like

thanks. I have done it with importing calendar module to my page.module.ts