twinssbc / Ionic-Calendar

A calendar directive for Ionic framework
http://twinssbc.github.io/Ionic-Calendar/demo
MIT License
159 stars 73 forks source link

Runtime Error - Cannot not read property 'currentDate' of undefined #172

Closed j-oun closed 6 years ago

j-oun commented 6 years ago

Trying to add this calendar to a page on my Ionic app.

I've added it to calendar.module.ts

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { CalendarPage } from './calendar';
import { NgCalendarModule  } from 'ionic2-calendar';

@NgModule({
  declarations: [
    CalendarPage
  ],
  imports: [
    NgCalendarModule,
    IonicPageModule.forChild(CalendarPage),
  ],
  entryComponents: [
    CalendarPage
  ]
})
export class CalendarPageModule {}

Here is the HTML:

  <ion-navbar>
    <ion-title>calendar</ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
  <calendar [eventSource]="eventSource"
  [calendarMode]="calendar.mode"
  [currentDate]="calendar.currentDate"
  (onCurrentDateChanged)="onCurrentDateChanged($event)"
  (onRangeChanged)="reloadSource(startTime, endTime)"
  (onEventSelected)="onEventSelected($event)"
  (onTitleChanged)="onViewTitleChanged($event)"
  (onTimeSelected)="onTimeSelected($event)"
  step="30">
</calendar>
</ion-content>