How can I change the tab from the app component. I would like to change the tabs and after “push” a page when a new notification is received (for example).
@Component({
template: '<ion-tabs #qTabs>
<ion-tab [root]="tab1Root" tabTitle="Home" tabIcon="home"></ion-tab>
<ion-tab [root]="tab2Root" tabTitle="profile" tabIcon="contact"></ion-tab>
</ion-tabs>'
})
export class TabsPage {
// this tells the tabs component which Pages
// should be each tab's root Page
tab1Root: any = HomePage;
tab2Root: any = ProfilePage;
constructor(public playerService: PlayerService, public NavCtrl: NavController) {
}
}
I know I’m late. ZiFFel’s solution is correct, what was not mentioned is to inject navParams in TabsPage constructor and use @ViewChild to get reference of the tabs #mytabs then select the tab from the tabsRef.