diff --git a/src/components/nav/test/basic/app-module.ts b/src/components/nav/test/basic/app-module.ts index 75fe264b63..467917a2fe 100644 --- a/src/components/nav/test/basic/app-module.ts +++ b/src/components/nav/test/basic/app-module.ts @@ -1,5 +1,5 @@ import { NgModule, Component, ViewChild } from '@angular/core'; -import { App, AlertController, Content, DeepLinkConfig, IonicApp, IonicModule, NavController, NavParams, ViewController } from '../../../..'; +import { App, AlertController, Content, DeepLinkConfig, IonicApp, IonicModule, NavController, NavParams, Tabs, Tab, ModalController, ViewController } from '../../../..'; @Component({ selector: 'my-cmp', @@ -28,6 +28,7 @@ export class MyCmpTest {} Push to FullPage Push to PrimaryHeaderPage + Push to Tabs Page Push to AnotherPage Text Input @@ -134,6 +135,12 @@ export class FirstPage { }); } + pushTabsPage() { + this.navCtrl.push(TabsPage).catch(() => { + }); + } + + quickPush() { this.navCtrl.push(AnotherPage).catch(() => { }); @@ -475,6 +482,230 @@ export class AnotherPage { } +// +// Tab 1 +// +@Component({ + template: ` + + + Heart + + + + + + + Tab 1 + + + Back + + Item {{i}} {{i}} {{i}} {{i}} + + + Select Previous Tab + + + App Nav Pop + + + ` +}) +export class Tab1 { + items: any[] = []; + + constructor(private tabs: Tabs, private app: App, private nav: NavController) { + for (var i = 1; i <= 250; i++) { + this.items.push(i); + } + } + + goBack() { + this.nav.parent.parent.pop(); + } + + goTo() { + this.nav.push(TabItemPage); + } + + selectPrevious() { + this.tabs.select(this.tabs.previousTab()); + } + + appNavPop() { + this.app.navPop(); + } +} + +// +// Tab 2 +// +@Component({ + template: ` + + + Schedule + + + + + + + + {{session.name}} {{session.name}} {{session.name}} + {{session.location}} {{session.location}} {{session.location}} + + + SpeakerInfo + Add toFavorites + + + + + Select Previous Tab + + + App Nav Pop + + + ` +}) +export class Tab2 { + sessions: any[] = []; + + constructor(private tabs: Tabs, private app: App) { + for (var i = 1; i <= 250; i++) { + this.sessions.push({ + name: 'Name ' + i, + location: 'Location: ' + i + }); + } + } + + selectPrevious() { + this.tabs.select(this.tabs.previousTab()); + } + + appNavPop() { + this.app.navPop(); + } +} + +// +// Tab 3 +// +@Component({ + template: ` + + + + + + Stopwatch + + + + + Tab 3 + + Present Alert + Present Modal + + + Select Previous Tab + + + App Nav Pop + + + ` +}) +export class Tab3 { + constructor(private alertCtrl: AlertController, private modalCtrl: ModalController, private tabs: Tabs, private app: App) {} + + presentAlert() { + let alert = this.alertCtrl.create({ + title: 'Alert Title!', + buttons: ['Dismiss'] + }); + alert.present(); + } + + presentModal() { + //this.modalCtrl.create(MyModal).present(); + } + + selectPrevious() { + this.tabs.select(this.tabs.previousTab()); + } + + appNavPop() { + this.app.navPop(); + } +} + + +@Component({ + template: ` + + + + Menu + + + + + + Close Menu + + + + + + + + + + + + + ` +}) +export class TabsPage { + root1 = Tab1; + root2 = Tab2; + root3 = Tab3; + + onChange(ev: Tab) { + console.log('Changed tab', ev); + } + + onSelect(ev: Tab) { + console.log('Selected tab', ev); + } +} + +@Component({ + template: ` + + + Tab Item + + + + + Hello moto + + ` +}) +export class TabItemPage { + items: any[] = []; + + constructor(private tabs: Tabs, private app: App) { + } +} + @Component({ template: `` @@ -491,6 +722,9 @@ export const deepLinkConfig: DeepLinkConfig = { { component: MyCmpTest, name: 'tab1-page1' }, { component: FullPage, name: 'full-page', defaultHistory: ['first-page', 'another-page'] }, { component: PrimaryHeaderPage, name: 'primary-header-page', defaultHistory: ['first-page', 'full-page'] }, + { component: Tabs, name: 'tabs' }, + { component: Tab1, name: 'tab1' }, + { component: TabItemPage, name: 'item' } ] }; @@ -501,7 +735,12 @@ export const deepLinkConfig: DeepLinkConfig = { AnotherPage, MyCmpTest, FullPage, - PrimaryHeaderPage + PrimaryHeaderPage, + TabsPage, + Tab1, + Tab2, + Tab3, + TabItemPage ], imports: [ IonicModule.forRoot(E2EApp, null, deepLinkConfig) @@ -512,7 +751,12 @@ export const deepLinkConfig: DeepLinkConfig = { FirstPage, AnotherPage, FullPage, - PrimaryHeaderPage + PrimaryHeaderPage, + TabsPage, + Tab1, + Tab2, + Tab3, + TabItemPage ] }) export class AppModule {}
+ Select Previous Tab +
+ App Nav Pop +
{{session.location}} {{session.location}} {{session.location}}
+ Present Alert + Present Modal +