How to access @Page members?


#1

Taking the ionic2-starter-tabs example and giving page1 a member:

@Page({
  templateUrl: 'build/pages/page1/page1.html'
})
export class Page1 {
  data: string;

  constructor() {
    this.data = "Hi, I'm page1";
  }

  getData(): string {
    return this.data;
  }
}

In the controlling tabs class:

@Page({
  templateUrl: 'build/pages/tabs/tabs.html'
})
export class TabsPage {
  constructor() {
    // this tells the tabs component which Pages
    // should be each tab's root Page
    this.tab1Root = Page1;
    this.tab2Root = Page2;
    this.tab3Root = Page3;
  }

  // Tabs change event
  tabChanged() {
    ... getData() of selected Tab?
    console.log( )  <-- "Hi, I'm page1"
  }
}

How is it possible to access getData() or data itself from the Tabs class?

I can access the Tab class via Tabs.getSelected() method - but I’m unable to access the Page1 class itself.
Any advice?