I need to call function
in another controller in ionic 2
, maybe?
below my code, and I want to call loadPeople
in the tab controller.
home.ts
import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import {PeopleService} from '../../providers/people-service/people-service'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { constructor(public navCtrl: NavController,public peopleService: PeopleService) { this.loadPeople(); } loadPeople(){ this.peopleService.load() .then(data => { this.people = data; }); } }
tabs.ts
import { Component } from '@angular/core'; import { HomePage } from '../home/home'; import { AboutPage } from '../about/about'; import { ContactPage } from '../contact/contact'; @Component({ templateUrl: 'tabs.html' }) export class TabsPage {
in tabs.ts I want to call the loadPeople
function on the tab selected , how can I do this?
source share