import { Component , NgZone } from "@angular/core" ; import { ModalController , NavController , Platform } from 'ionic-angular' ; import { BirthdayService } from '../../services/birthday.service' ; import { DetailsPage } from '../details/details' ; @ Component ( { selector : 'page-home' , templateUrl : 'home.html' } ) export class HomePage { public birthdays = [ ] ; constructor ( private birthdayService , private nav , private platform , private zone , private modalCtrl ) { } ionViewDidLoad ( ) { this . platform . ready ( ) . then ( ( ) => { this . birthdayService . initDB ( ) ; this . birthdayService . getAll ( ) . then ( data => { this . zone . run ( ( ) => { this . birthdays = data ; } ) ; } ) . catch ( console . error . bind ( console ) ) ; } ) ; } showDetail ( birthday ) { let modal = this . modalCtrl . create ( DetailsPage , { birthday : birthday } ) ; modal . present ( ) ; } }