Skip to content

Commit

Permalink
fix(navigation): account for condition of toggling one view with tabs…
Browse files Browse the repository at this point in the history
… to another view with tabs
  • Loading branch information
danbucholtz committed Oct 5, 2017
1 parent 2bd89fe commit c963745
Show file tree
Hide file tree
Showing 57 changed files with 1,164 additions and 3 deletions.
38 changes: 38 additions & 0 deletions src/components/nav/test/toggle-basic/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Component, ViewChild } from '@angular/core';
import { NavController } from '../../../../..';
@Component({
template: `
<ion-menu [content]="content">
<ion-header>
<ion-toolbar>
<ion-title>Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<button ion-item (click)="goToTabsOne()" menuClose>
Page One
</button>
<button ion-item (click)="goToTabsTwo()" menuClose>
Page Four
</button>
</ion-list>
</ion-content>
</ion-menu>
<ion-nav [root]="root" #content name="rootNav"></ion-nav>`
})
export class AppComponent {
root = 'RootPage';

@ViewChild('content') nav: NavController;

goToTabsOne() {
this.nav.setRoot('FirstPage');
}

goToTabsTwo() {
this.nav.setRoot('FourthPage');
}
}
17 changes: 17 additions & 0 deletions src/components/nav/test/toggle-basic/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule } from '../../../../..';

import { AppComponent } from './app.component';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
IonicModule.forRoot(AppComponent, { swipeBackEnabled: true, preloadModules: true }),
],
bootstrap: [IonicApp]
})
export class AppModule {}
5 changes: 5 additions & 0 deletions src/components/nav/test/toggle-basic/app/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Fifth Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
Fifth Page
<div>
User ID: {{userId}}
</div>
<div>
Name {{name}}
</div>
<button ion-button (click)="goToNextPage()">Next Page</button>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { FifthPage } from './fifth-page';

@NgModule({
imports: [
IonicPageModule.forChild(FifthPage)
],
declarations: [
FifthPage
]
})
export class FifthPageModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from '../../../../../..';

@IonicPage({
segment: 'fifthPage/user/:userId/name/:name'
})
@Component({
templateUrl: 'fifth-page.html'
})
export class FifthPage {

userId: string;
name: string;
constructor(public nav: NavController, public params: NavParams) {
this.userId = this.params.data.userId;
this.name = this.params.data.name;
}

goToNextPage() {
this.nav.push('SixthPage', { paramOne: 'Kelly Kapore', paramTwo: 'Creed Bratton'});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>First Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
First Page
<div>
<button ion-button (click)="clickMe()">Go To Next Page</button>
</div>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { FirstPage } from './first-page';

@NgModule({
imports: [
IonicPageModule.forChild(FirstPage)
],
declarations: [
FirstPage
]
})
export class FirstPageModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, } from '../../../../../..';

@IonicPage()
@Component({
templateUrl: 'first-page.html'
})
export class FirstPage {
constructor(public nav: NavController) {
}

clickMe() {
this.nav.push('SecondPage', { userId: '123', name: 'Phyllis Vance, Vance Refridgeration'});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Fourth Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
Fourth Page
<div>
<button ion-button (click)="clickMe()">Go To Next Page</button>
</div>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { FourthPage } from './fourth-page';

@NgModule({
imports: [
IonicPageModule.forChild(FourthPage)
],
declarations: [
FourthPage
]
})
export class FourthPageModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, } from '../../../../../..';

@IonicPage()
@Component({
templateUrl: 'fourth-page.html'
})
export class FourthPage {
constructor(public nav: NavController) {
}

clickMe() {
this.nav.push('FifthPage', { userId: '456', name: 'Ryan Howard'});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { RootPage } from './root-page';

@NgModule({
imports: [
IonicPageModule.forChild(RootPage)
],
declarations: [
RootPage
]
})
export class RootPageModule { }
25 changes: 25 additions & 0 deletions src/components/nav/test/toggle-basic/pages/root-page/root-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, } from '../../../../../..';

@IonicPage()
@Component({
template: `
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Root Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
Root Page
<button ion-button secondary menuToggle>Toggle Menu</button>
</ion-content>
`
})
export class RootPage {

constructor(public nav: NavController) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Second Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<div>
User ID: {{userId}}
</div>
<div>
Name {{name}}
</div>
<button ion-button (click)="goToNextPage()">Next Page</button>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { SecondPage } from './second-page';

@NgModule({
imports: [
IonicPageModule.forChild(SecondPage)
],
declarations: [
SecondPage
]
})
export class SecondPageModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from '../../../../../..';

@IonicPage({
segment: 'secondPage/user/:userId/name/:name'
})
@Component({
templateUrl: 'second-page.html'
})
export class SecondPage {

userId: string;
name: string;
constructor(public nav: NavController, public params: NavParams) {
this.userId = this.params.data.userId;
this.name = this.params.data.name;
}

goToNextPage() {
this.nav.push('ThirdPage', { paramOne: 'Tobey', paramTwo: 'Kevin'});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Sixth Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<h2>Sixth Page</h2>
<div>
Param One: {{paramOne}}
</div>
<div>
Param Two: {{paramTwo}}
</div>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { SixthPage } from './sixth-page';

@NgModule({
imports: [
IonicPageModule.forChild(SixthPage)
],
declarations: [
SixthPage
]
})
export class SixthPageModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from '../../../../../..';

@IonicPage({
segment: 'sixthPage/paramOne/:paramOne/paramTwo/:paramTwo'
})
@Component({
templateUrl: 'sixth-page.html'
})
export class SixthPage {

paramOne: string;
paramTwo: string;

constructor(public nav: NavController, public params: NavParams) {
this.paramOne = this.params.data.paramOne;
this.paramTwo = this.params.data.paramTwo;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Third Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<h2>Third Page</h2>
<div>
Param One: {{paramOne}}
</div>
<div>
Param Two: {{paramTwo}}
</div>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { ThirdPage } from './third-page';

@NgModule({
imports: [
IonicPageModule.forChild(ThirdPage)
],
declarations: [
ThirdPage
]
})
export class ThirdPageModule { }
Loading

0 comments on commit c963745

Please sign in to comment.