Hi friends,
after I had upgrated to beta7, the method this.app.getComponent is returning undefined, breaking my page.
Here is my code:
tabs.ts
import {Page, IonicApp, NavController} from 'ionic-angular';
import {perdidosPage} from '../perdidos/perdidos';
import {seguindoPage} from '../seguindo/seguindo';
import {meusPetsPage} from '../meuspets/meuspets';
import {NotificationsPage} from '../notifications/notifications';
@Page({
templateUrl: 'build/pages/tabs/tabs.html'
})
export class TabsPage {
// this tells the tabs component which Pages
// should be each tab's root Page
tabPerdidos: any = perdidosPage;
tabSeguindo: any = seguindoPage;
tabMeusPets: any = meusPetsPage;
notificationPage: any = NotificationsPage;
nav: any;
app: any;
maintabs: any;
activeTabTitle: string;
showAdotarBtn: boolean;
constructor(nav: NavController, app: IonicApp) {
this.app = app;
this.nav = nav;
this.showAdotarBtn = false; // temporario... futuramente vamos implementar algo
this.maintabs = this.app.getComponent('maintabs');
}
goToNotifications() {
this.nav.push(this.notificationPage);
}
getActiveTab() {
console.log("tabs", this.maintabs);
this.activeTabTitle = this.maintabs.getSelected().tabTitle;
}
}
tabs.html:
<ion-navbar *navbar hideBackButton="true">
<ion-toolbar>
<ion-buttons start *ngIf="showAdotarBtn">
<button>
<ion-icon name="heart"></ion-icon> Adotar
</button>
</ion-buttons>
<ion-buttons end>
<button (click)="goToNotifications()">
<ion-icon name="notifications"></ion-icon>
</button>
<button>
<ion-icon name="more"></ion-icon>
</button>
</ion-buttons>
<ion-title>{{activeTabTitle}}</ion-title>
</ion-toolbar>
</ion-navbar>
<ion-tabs id="maintabs" (change)="getActiveTab()">
<ion-tab [root]="tabPerdidos" tabTitle="Perdidos" tabIcon="pin"></ion-tab>
<ion-tab [root]="tabSeguindo" tabTitle="Acompanhando" tabIcon="checkmark"></ion-tab>
<ion-tab [root]="tabMeusPets" tabTitle="Meus" tabIcon="paw"></ion-tab>
</ion-tabs>
This code worked in beta 6.
If anyone had a clue, please tell me.
Thank you and sorry the bad English.