From 3a208b6c8d3b3b47281ee1f833ec65261bdc3c32 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Thu, 6 Oct 2016 19:23:30 -0500 Subject: [PATCH] Expand nav basic test --- src/components/nav/test/basic/app-module.ts | 250 +++++++++++++++++++- 1 file changed, 247 insertions(+), 3 deletions(-) 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 {} + 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 + + + + + Item {{i}} {{i}} {{i}} {{i}} + +

+ +

+

+ +

+
+ ` +}) +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}}

+
+ + + + +
+
+

+ +

+

+ +

+
+ ` +}) +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

+

+ + +

+

+ +

+

+ +

+
+ ` +}) +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 + + + + + + + + + + + + + + + + + ` +}) +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 {}