mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
@ -1,6 +1,7 @@
|
|||||||
|
import {ViewChild} from 'angular2/core';
|
||||||
import {RouteConfig, Location} from 'angular2/router';
|
import {RouteConfig, Location} from 'angular2/router';
|
||||||
|
|
||||||
import {App, Page, NavController, Modal, ViewController} from 'ionic/ionic';
|
import {App, Page, NavController, Modal, ViewController, Tabs} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
@ -57,10 +58,24 @@ class ChatPage {
|
|||||||
templateUrl: './tabs.html'
|
templateUrl: './tabs.html'
|
||||||
})
|
})
|
||||||
class TabsPage {
|
class TabsPage {
|
||||||
|
@ViewChild(Tabs) tabs: Tabs;
|
||||||
|
|
||||||
constructor(private nav: NavController) {
|
constructor(private nav: NavController) {
|
||||||
this.tab1Root = Tab1Page1
|
this.tab1Root = Tab1Page1;
|
||||||
this.tab2Root = Tab2Page1
|
this.tab2Root = Tab2Page1;
|
||||||
this.tab3Root = Tab3Page1
|
this.tab3Root = Tab3Page1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.tabs.change.subscribe(tab => {
|
||||||
|
console.log('tabs.change.subscribe', tab.index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onTabChange() {
|
||||||
|
// wired up through the template
|
||||||
|
// <ion-tabs (change)="onTabChange()">
|
||||||
|
console.log('onTabChange');
|
||||||
}
|
}
|
||||||
|
|
||||||
chat() {
|
chat() {
|
||||||
@ -68,10 +83,6 @@ class TabsPage {
|
|||||||
let modal = Modal.create(ChatPage);
|
let modal = Modal.create(ChatPage);
|
||||||
this.nav.present(modal);
|
this.nav.present(modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
onTabChange() {
|
|
||||||
console.log('onTabChange');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -86,19 +97,25 @@ class TabsPage {
|
|||||||
'<ion-content padding>' +
|
'<ion-content padding>' +
|
||||||
'<p><button id="goToTab1Page2" (click)="push()">Go to Tab 1, Page 2</button></p>' +
|
'<p><button id="goToTab1Page2" (click)="push()">Go to Tab 1, Page 2</button></p>' +
|
||||||
'<p><button (click)="logout()">Logout</button></p>' +
|
'<p><button (click)="logout()">Logout</button></p>' +
|
||||||
|
'<p><button (click)="favoritesTab()">Favorites Tab</button></p>' +
|
||||||
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
|
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
|
||||||
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
|
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
|
||||||
'</ion-content>'
|
'</ion-content>'
|
||||||
})
|
})
|
||||||
class Tab1Page1 {
|
class Tab1Page1 {
|
||||||
constructor(nav: NavController) {
|
constructor(nav: NavController, tabs: Tabs) {
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
|
this.tabs = tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
push() {
|
push() {
|
||||||
this.nav.push(Tab1Page2)
|
this.nav.push(Tab1Page2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
favoritesTab() {
|
||||||
|
this.tabs.select(1);
|
||||||
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
this.nav.rootNav.setRoot(SignIn, null, { animate: true, direction: 'back' });
|
this.nav.rootNav.setRoot(SignIn, null, { animate: true, direction: 'back' });
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user