import { Component } from ‘@angular/core’;
import { NavController , ModalController } from ‘ionic-angular’;
import { EmployeePage } from ‘./…/employee/employee.ts’;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
public employees : [] = [];
constructor(public navCtrl: NavController,public modalCtrl: ModalController, public employeeProvider : EmployeeProvider) {
}
ionViewDidEnter() {
this.employeeProvider.createPouchDB();
this.employeeProvider.read()
.then(employees => {
this.employees = employees;
})
.catch((err)=>{});
}
showDetails(employee) {
let modal = this.modalCtrl.create(EmployeePage, { employee: employee });
modal.present();
}
}