Hi everybody, first of all sorry for my english. I have a problem with the Tabs. I have a page named “Home” with 3 button: song, news and bio. When I press one of this button I would like that the user can go to the right page with the tabs on the bottom, but the tab should be selected according the right page and the user can navigate without going back to the homepage.
The Tabs are declared in the page “Hometab”.
Can you help me? Thanks
home.ts:
@Component({
selector: 'page-home',
templateUrl: 'home.html',
providers: [HttpProvider]
})
export class HomePage {
data: any;
constructor(private screenOrientation: ScreenOrientation, public navCtrl: NavController, private httpProvider: HttpProvider,public navParams: NavParams) {
}
OpenSong() {
this.navCtrl.push(SongPage);
}
OpenNews(){
this.navCtrl.push(NewsPage);
}
OpenBio() {
this.navCtrl.push(BioPage);
}
};
hometab.ts:
@Component({
selector: 'page-hometab',
templateUrl: 'hometab.html'
})
export class HometabPage {
tab1Root: any = SongPage;
tab2Root: any = NewsPage;
tab3Root: any = BioPage;
constructor(public navCtrl: NavController) {
}
}
hometab.html:
<ion-tabs >
<ion-tab [root]="tab1Root" tabTitle="song" tabIcon="home"></ion-tab>
<ion-tab [root]="tab2Root" tabTitle="news" tabIcon="text"></ion-tab>
<ion-tab [root]="tab3Root" tabTitle="bio" tabIcon="stats"></ion-tab>
</ion-tabs>
app.component.ts:
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
statusBar.styleDefault();
splashScreen.hide();
});
}
}