test(): update to public navCtrl convention

This commit is contained in:
Adam Bradley
2016-08-04 13:50:15 -05:00
parent 478ac45211
commit 3c493652b2
36 changed files with 154 additions and 145 deletions

View File

@ -85,7 +85,7 @@ export class ApiDemoPage {
config: any; config: any;
initialConfig: any; initialConfig: any;
constructor(public platform: Platform, public nav: NavController) { constructor(public platform: Platform, public navCtrl: NavController) {
if (window.localStorage.getItem('configDemo') !== null) { if (window.localStorage.getItem('configDemo') !== null) {
this.config = JSON.parse(window.localStorage.getItem('configDemo')); this.config = JSON.parse(window.localStorage.getItem('configDemo'));
@ -113,7 +113,7 @@ export class ApiDemoPage {
} }
push() { push() {
this.nav.push(PushPage); this.navCtrl.push(PushPage);
} }
} }
@ -121,10 +121,10 @@ export class ApiDemoPage {
templateUrl: 'page.html' templateUrl: 'page.html'
}) })
export class PushPage { export class PushPage {
constructor(public nav: NavController) {} constructor(public navCtrl: NavController) {}
pop() { pop() {
this.nav.pop(); this.navCtrl.pop();
} }
} }

View File

@ -11,7 +11,7 @@ class ApiDemoPage {
editButton: string = 'Edit'; editButton: string = 'Edit';
editing: boolean = false; editing: boolean = false;
constructor(private nav: NavController) { constructor(public navCtrl: NavController) {
this.songs = [ this.songs = [
{ {
title: 'Everything Beta', title: 'Everything Beta',

View File

@ -7,7 +7,7 @@ import { ionicBootstrap, LoadingController, NavController } from 'ionic-angular'
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
class Page1 { class Page1 {
constructor(private loadingCtrl: LoadingController, private nav: NavController) {} constructor(public loadingCtrl: LoadingController, public navCtrl: NavController) {}
presentLoadingIos() { presentLoadingIos() {
let loading = this.loadingCtrl.create({ let loading = this.loadingCtrl.create({
@ -100,7 +100,7 @@ class Page1 {
loading.present(); loading.present();
setTimeout(() => { setTimeout(() => {
this.nav.push(Page2); this.navCtrl.push(Page2);
}, 1000); }, 1000);
setTimeout(() => { setTimeout(() => {

View File

@ -35,7 +35,6 @@ export class ModalContentPage {
myParam: string; myParam: string;
constructor( constructor(
public nav: NavController,
public viewCtrl: ViewController, public viewCtrl: ViewController,
params: NavParams params: NavParams
) { ) {

View File

@ -9,10 +9,10 @@ import { ionicBootstrap, NavController, NavParams } from 'ionic-angular';
export class ApiDemoPage { export class ApiDemoPage {
myParam: string = ''; myParam: string = '';
constructor(public nav: NavController) {} constructor(public navCtrl: NavController) {}
pushParams() { pushParams() {
this.nav.push(PushPage, { 'myParam': this.myParam }); this.navCtrl.push(PushPage, { 'myParam': this.myParam });
} }
} }
@ -23,7 +23,7 @@ export class ApiDemoPage {
export class PushPage { export class PushPage {
myParam: string; myParam: string;
constructor(public nav: NavController, params: NavParams) { constructor(params: NavParams) {
this.myParam = params.get('myParam'); this.myParam = params.get('myParam');
} }
} }

View File

@ -9,10 +9,10 @@ var PAGE_NUM = 2;
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
export class ApiDemoPage { export class ApiDemoPage {
constructor(public nav: NavController) {} constructor(public navCtrl: NavController) {}
push() { push() {
this.nav.push(PushPage); this.navCtrl.push(PushPage);
} }
} }
@ -22,18 +22,18 @@ export class ApiDemoPage {
export class PushPage { export class PushPage {
pageNum = PAGE_NUM; pageNum = PAGE_NUM;
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
push() { push() {
PAGE_NUM++; PAGE_NUM++;
this.nav.push(PushPage); this.navCtrl.push(PushPage);
} }
pop() { pop() {
if (PAGE_NUM > 2) { if (PAGE_NUM > 2) {
PAGE_NUM--; PAGE_NUM--;
} }
this.nav.pop(); this.navCtrl.pop();
} }
} }

View File

@ -112,7 +112,7 @@ export class ActionSheet extends ViewController {
* *
* export class MyClass{ * export class MyClass{
* *
* constructor(private actionSheetCtrl: ActionSheetController) {} * constructor(public actionSheetCtrl: ActionSheetController) {}
* *
* presentActionSheet() { * presentActionSheet() {
* let actionSheet = this.actionSheetCtrl.create({ * let actionSheet = this.actionSheetCtrl.create({

View File

@ -8,7 +8,7 @@ import { FormBuilder, ControlGroup, Validators } from '@angular/common';
}) })
export class E2EPage { export class E2EPage {
constructor(private alertCtrl: AlertController, private nav: NavController) {} constructor(public alertCtrl: AlertController, public navCtrl: NavController) {}
submit() { submit() {
var alert = this.alertCtrl.create({ var alert = this.alertCtrl.create({
@ -26,7 +26,7 @@ export class E2EPage {
alert.onDidDismiss(() => { alert.onDidDismiss(() => {
console.log('dismiss'); console.log('dismiss');
this.nav.push(AnotherPage); this.navCtrl.push(AnotherPage);
}); });
alert.present(); alert.present();
@ -63,7 +63,7 @@ export class E2EPage {
class AnotherPage { class AnotherPage {
form: ControlGroup; form: ControlGroup;
constructor(private nav: NavController, private alertCtrl: AlertController, private loadingCtrl: LoadingController, private builder: FormBuilder) { constructor(public navCtrl: NavController, public alertCtrl: AlertController, public loadingCtrl: LoadingController, public builder: FormBuilder) {
this.form = builder.group({ this.form = builder.group({
name: builder.control('', Validators.compose([ name: builder.control('', Validators.compose([
Validators.required, Validators.required,
@ -98,7 +98,7 @@ class AnotherPage {
role: 'cancel', role: 'cancel',
handler: () => { handler: () => {
alert.dismiss().then(() => { alert.dismiss().then(() => {
this.nav.pop(); this.navCtrl.pop();
}); });
return false; return false;
} }
@ -137,7 +137,7 @@ class AnotherPage {
alert.dismiss().then(() => { alert.dismiss().then(() => {
// after the alert has been dismissed // after the alert has been dismissed
// then you can do another nav transition // then you can do another nav transition
this.nav.pop(); this.navCtrl.pop();
}); });
}, 100); }, 100);

View File

@ -45,7 +45,7 @@ export class OtherData {
` `
}) })
class MyModal { class MyModal {
constructor(private viewCtrl: ViewController) {} constructor(public viewCtrl: ViewController) {}
dismissModal() { dismissModal() {
this.viewCtrl.dismiss(); this.viewCtrl.dismiss();
@ -60,13 +60,13 @@ class Page1 {
page2 = Page2; page2 = Page2;
sort: string = 'all'; sort: string = 'all';
constructor(private nav: NavController, private someData: SomeData, private otherData: OtherData) { constructor(public navCtrl: NavController, public someData: SomeData, public otherData: OtherData) {
console.log('Got some data from', someData.getData()); console.log('Got some data from', someData.getData());
console.log('Got some data from', otherData.getData()); console.log('Got some data from', otherData.getData());
} }
goToTabs() { goToTabs() {
this.nav.push(TabsPage); this.navCtrl.push(TabsPage);
} }
} }
@ -78,7 +78,7 @@ class Page2 {
page1 = Page1; page1 = Page1;
page3 = Page3; page3 = Page3;
constructor(private modalCtrl: ModalController) {} constructor(public modalCtrl: ModalController) {}
openModal() { openModal() {
this.modalCtrl.create(MyModal).present(); this.modalCtrl.create(MyModal).present();
@ -90,10 +90,10 @@ class Page2 {
templateUrl: 'page3.html' templateUrl: 'page3.html'
}) })
class Page3 { class Page3 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
goBack() { goBack() {
this.nav.pop(); this.navCtrl.pop();
} }
} }
@ -118,9 +118,7 @@ class Page3 {
</ion-content> </ion-content>
` `
}) })
class TabPage1 { class TabPage1 {}
constructor(private nav: NavController) {}
}
@Component({ @Component({
@ -131,10 +129,10 @@ class TabsPage {
tab2Root = Page2; tab2Root = Page2;
tab3Root = Page3; tab3Root = Page3;
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
goBack() { goBack() {
this.nav.pop(); this.navCtrl.pop();
} }
} }

View File

@ -6,7 +6,7 @@ import { ionicBootstrap, MenuController, NavController, AlertController, Nav, Re
templateUrl: 'page1.html' templateUrl: 'page1.html'
}) })
class Page1 { class Page1 {
constructor(private nav: NavController, private alertCtrl: AlertController) {} constructor(public navCtrl: NavController, public alertCtrl: AlertController) {}
presentAlert() { presentAlert() {
let alert = this.alertCtrl.create({ let alert = this.alertCtrl.create({
@ -19,7 +19,7 @@ class Page1 {
} }
goToPage1() { goToPage1() {
this.nav.push(Page1); this.navCtrl.push(Page1);
} }
doRefresh(refresher: Refresher) { doRefresh(refresher: Refresher) {

View File

@ -10,7 +10,7 @@ class E2EPage1 {
items: number[] = []; items: number[] = [];
enabled: boolean = true; enabled: boolean = true;
constructor(private nav: NavController) { constructor(public navCtrl: NavController) {
for (var i = 0; i < 30; i++) { for (var i = 0; i < 30; i++) {
this.items.push( this.items.length ); this.items.push( this.items.length );
} }
@ -35,7 +35,7 @@ class E2EPage1 {
} }
goToPage2() { goToPage2() {
this.nav.push(E2EPage2); this.navCtrl.push(E2EPage2);
} }
toggleInfiniteScroll() { toggleInfiniteScroll() {
@ -46,10 +46,10 @@ class E2EPage1 {
@Component({ @Component({
template: '<ion-content><button (click)="nav.pop()">Pop</button></ion-content>' template: '<ion-content><button (click)="navCtrl.pop()">Pop</button></ion-content>'
}) })
class E2EPage2 { class E2EPage2 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
} }

View File

@ -11,14 +11,14 @@ import { ionicBootstrap, NavController, NavParams } from '../../../../../src';
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<p>{{session.description}}</p> <p>{{session.description}}</p>
<p><button (click)="nav.pop()">Go Back</button></p> <p><button (click)="navCtrl.pop()">Go Back</button></p>
</ion-content> </ion-content>
` `
}) })
class SessionDetail { class SessionDetail {
session: any; session: any;
constructor(params: NavParams, public nav: NavController) { constructor(params: NavParams, public navCtrl: NavController) {
this.session = params.data; this.session = params.data;
} }
} }
@ -30,14 +30,14 @@ class SessionDetail {
class SessionList { class SessionList {
data = data; data = data;
constructor(public nav: NavController) {} constructor(public navCtrl: NavController) {}
addFavorite(timeSlot: any, session: any, slidingItem: any) { addFavorite(timeSlot: any, session: any, slidingItem: any) {
console.error('addFavorite', timeSlot, session, slidingItem); console.error('addFavorite', timeSlot, session, slidingItem);
} }
openSession(session: any) { openSession(session: any) {
this.nav.push(SessionDetail, session); this.navCtrl.push(SessionDetail, session);
} }
reload() { reload() {

View File

@ -6,7 +6,7 @@ import { ionicBootstrap, LoadingController, NavController } from '../../../../..
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
class E2EPage { class E2EPage {
constructor(private loadingCtrl: LoadingController, private nav: NavController) {} constructor(public loadingCtrl: LoadingController, public navCtrl: NavController) {}
presentLoadingIos() { presentLoadingIos() {
let loading = this.loadingCtrl.create({ let loading = this.loadingCtrl.create({
@ -99,7 +99,7 @@ class E2EPage {
loading.present(); loading.present();
setTimeout(() => { setTimeout(() => {
this.nav.push(Page2); this.navCtrl.push(Page2);
}, 1000); }, 1000);
setTimeout(() => { setTimeout(() => {
@ -108,7 +108,7 @@ class E2EPage {
} }
goToPage2() { goToPage2() {
this.nav.push(Page2); this.navCtrl.push(Page2);
} }
presentLoadingMultiple() { presentLoadingMultiple() {
@ -180,7 +180,7 @@ class E2EPage {
loading3.present(); loading3.present();
setTimeout(() => { setTimeout(() => {
this.nav.push(Page2); this.navCtrl.push(Page2);
}, 1000); }, 1000);
}, 1000); }, 1000);
} }
@ -207,16 +207,16 @@ class E2EPage {
` `
}) })
class Page2 { class Page2 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
ionViewLoaded() { ionViewLoaded() {
setTimeout(() => { setTimeout(() => {
this.nav.push(Page3); this.navCtrl.push(Page3);
}, 1000); }, 1000);
} }
goToPage3() { goToPage3() {
this.nav.push(Page3); this.navCtrl.push(Page3);
} }
} }

View File

@ -6,7 +6,7 @@ import { ionicBootstrap, LoadingController, NavController } from '../../../../..
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
class E2EPage { class E2EPage {
constructor(private loadingCtrl: LoadingController, private nav: NavController) {} constructor(public loadingCtrl: LoadingController, public navCtrl: NavController) {}
presentLoading() { presentLoading() {
let loading = this.loadingCtrl.create({ let loading = this.loadingCtrl.create({
@ -26,7 +26,7 @@ class E2EPage {
loading.present(); loading.present();
setTimeout(() => { setTimeout(() => {
this.nav.push(Page2); this.navCtrl.push(Page2);
setTimeout(() => { setTimeout(() => {
loading.dismiss(); loading.dismiss();

View File

@ -40,20 +40,20 @@ import { Platform } from '../../platform/platform';
* @Component({...}) * @Component({...})
* export class MyPage { * export class MyPage {
* *
* constructor(private menu: MenuController) { * constructor(public menuCtrl: MenuController) {
* *
* } * }
* *
* openMenu() { * openMenu() {
* this.menu.open(); * this.menuCtrl.open();
* } * }
* *
* closeMenu() { * closeMenu() {
* this.menu.close(); * this.menuCtrl.close();
* } * }
* *
* toggleMenu() { * toggleMenu() {
* this.menu.toggle(); * this.menuCtrl.toggle();
* } * }
* *
* } * }

View File

@ -156,10 +156,10 @@ import { GestureController } from '../../gestures/gesture-controller';
* *
* @Component({...}) * @Component({...})
* export class MyPage { * export class MyPage {
* constructor(private menu: MenuController) {} * constructor(public menuCtrl: MenuController) {}
* *
* openMenu() { * openMenu() {
* this.menu.open(); * this.menuCtrl.open();
* } * }
* } * }
* ``` * ```

View File

@ -6,7 +6,7 @@ import { ionicBootstrap, MenuController, NavController, AlertController, Nav } f
templateUrl: 'page1.html' templateUrl: 'page1.html'
}) })
class Page1 { class Page1 {
constructor(private nav: NavController, private alertCtrl: AlertController) {} constructor(public navCtrl: NavController, public alertCtrl: AlertController) {}
presentAlert() { presentAlert() {
let alert = this.alertCtrl.create({ let alert = this.alertCtrl.create({
@ -19,7 +19,7 @@ class Page1 {
} }
goToPage2() { goToPage2() {
this.nav.push(Page2); this.navCtrl.push(Page2);
} }
} }
@ -30,10 +30,10 @@ class Page3 {}
@Component({templateUrl: 'page2.html'}) @Component({templateUrl: 'page2.html'})
class Page2 { class Page2 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
page3() { page3() {
this.nav.push(Page3); this.navCtrl.push(Page3);
} }
} }
@ -47,7 +47,7 @@ class E2EPage {
pages: Array<{title: string, component: any}>; pages: Array<{title: string, component: any}>;
@ViewChild(Nav) nav: Nav; @ViewChild(Nav) nav: Nav;
constructor(private menu: MenuController) { constructor(public menuCtrl: MenuController) {
this.rootPage = Page1; this.rootPage = Page1;
this.pages = [ this.pages = [
@ -63,16 +63,16 @@ class E2EPage {
this.nav.setRoot(page.component).then(() => { this.nav.setRoot(page.component).then(() => {
// wait for the root page to be completely loaded // wait for the root page to be completely loaded
// then close the menu // then close the menu
this.menu.close(); this.menuCtrl.close();
}); });
} }
openRightMenu() { openRightMenu() {
this.menu.open('right'); this.menuCtrl.open('right');
} }
openLeftMenu() { openLeftMenu() {
this.menu.open('left'); this.menuCtrl.open('left');
} }
onDrag(ev: any) { onDrag(ev: any) {

View File

@ -26,29 +26,29 @@ class E2EApp {
page2 = Page2; page2 = Page2;
rootPage = Page1; rootPage = Page1;
constructor(private app: App, private menu: MenuController) { constructor(public app: App, public menuCtrl: MenuController) {
this.menu1Active(); this.menu1Active();
} }
openPage(p) { openPage(p: any) {
// Get the <ion-nav> by id // Get the <ion-nav> by id
this.nav.setRoot(p); this.nav.setRoot(p);
} }
menu1Active() { menu1Active() {
this.menu.enable(true, 'menu1'); this.menuCtrl.enable(true, 'menu1');
this.menu.enable(false, 'menu2'); this.menuCtrl.enable(false, 'menu2');
this.menu.enable(false, 'menu3'); this.menuCtrl.enable(false, 'menu3');
} }
menu2Active() { menu2Active() {
this.menu.enable(false, 'menu1'); this.menuCtrl.enable(false, 'menu1');
this.menu.enable(true, 'menu2'); this.menuCtrl.enable(true, 'menu2');
this.menu.enable(false, 'menu3'); this.menuCtrl.enable(false, 'menu3');
} }
menu3Active() { menu3Active() {
this.menu.enable(false, 'menu1'); this.menuCtrl.enable(false, 'menu1');
this.menu.enable(false, 'menu2'); this.menuCtrl.enable(false, 'menu2');
this.menu.enable(true, 'menu3'); this.menuCtrl.enable(true, 'menu3');
} }
} }

View File

@ -14,7 +14,7 @@ class E2EApp {
rootView = Page1; rootView = Page1;
constructor(private alertCtrl: AlertController) { } constructor(public alertCtrl: AlertController) { }
openPage(menu: any, page: any) { openPage(menu: any, page: any) {
// close the menu when clicking a link from the menu // close the menu when clicking a link from the menu

View File

@ -14,7 +14,7 @@ class E2EApp {
rootView = Page1; rootView = Page1;
constructor(private alertCtrl: AlertController) { } constructor(public alertCtrl: AlertController) { }
openPage(menu: any, page: any) { openPage(menu: any, page: any) {
// close the menu when clicking a link from the menu // close the menu when clicking a link from the menu

View File

@ -14,7 +14,7 @@ class E2EApp {
rootView = Page1; rootView = Page1;
openPage(menu, page) { openPage(menu: any, page: any) {
// close the menu when clicking a link from the menu // close the menu when clicking a link from the menu
menu.close(); menu.close();

View File

@ -101,7 +101,7 @@ export class Modal extends ViewController {
* @Component(...) * @Component(...)
* class HomePage { * class HomePage {
* *
* constructor(private modalCtrl: ModalController) { * constructor(public modalCtrl: ModalController) {
* *
* } * }
* *
@ -141,7 +141,7 @@ export class Modal extends ViewController {
* @Component(...) * @Component(...)
* class HomePage { * class HomePage {
* *
* constructor(private modalCtrl: ModalController) { * constructor(public modalCtrl: ModalController) {
* *
* } * }
* *
@ -163,7 +163,7 @@ export class Modal extends ViewController {
* @Component(...) * @Component(...)
* class Profile { * class Profile {
* *
* constructor(private viewCtrl: ViewController) { * constructor(public viewCtrl: ViewController) {
* *
* } * }
* *

View File

@ -101,6 +101,26 @@ class E2EPage {
presentNavigableModal() { presentNavigableModal() {
this.modalCtrl.create(NavigableModal).present(); this.modalCtrl.create(NavigableModal).present();
} }
ionViewLoaded() {
console.log('E2EPage ionViewLoaded fired');
}
ionViewWillEnter() {
console.log('E2EPage ionViewWillEnter fired');
}
ionViewDidEnter() {
console.log('E2EPage ionViewDidEnter fired');
}
ionViewWillLeave() {
console.log('E2EPage ionViewWillLeave fired');
}
ionViewDidLeave() {
console.log('E2EPage ionViewDidLeave fired');
}
} }
@Component({ @Component({

View File

@ -71,7 +71,7 @@ import { ViewController } from './view-controller';
* import { NavController } from 'ionic-angular'; * import { NavController } from 'ionic-angular';
* *
* class MyComponent { * class MyComponent {
* constructor(private nav: NavController) { * constructor(public navCtrl: NavController) {
* *
* } * }
* } * }
@ -148,14 +148,14 @@ import { ViewController } from './view-controller';
* ` * `
* }) * })
* export class StartPage { * export class StartPage {
* constructor(private nav: NavController) { * constructor(public navCtrl: NavController) {
* } * }
* *
* pushPage(){ * pushPage(){
* // push another page on to the navigation stack * // push another page on to the navigation stack
* // causing the nav controller to transition to the new page * // causing the nav controller to transition to the new page
* // optional data can also be passed to the pushed page. * // optional data can also be passed to the pushed page.
* this.nav.push(OtherPage, { * this.navCtrl.push(OtherPage, {
* id: "123", * id: "123",
* name: "Carl" * name: "Carl"
* }); * });

View File

@ -8,7 +8,7 @@
* @usage * @usage
* ```ts * ```ts
* export class MyClass{ * export class MyClass{
* constructor(private params: NavParams){ * constructor(public params: NavParams){
* // userParams is an object we have in our nav-parameters * // userParams is an object we have in our nav-parameters
* this.params.get('userParams'); * this.params.get('userParams');
* } * }
@ -33,7 +33,7 @@ export class NavParams {
* *
* ```ts * ```ts
* export class MyClass{ * export class MyClass{
* constructor(private params: NavParams){ * constructor(public params: NavParams){
* // userParams is an object we have in our nav-parameters * // userParams is an object we have in our nav-parameters
* this.params.get('userParams'); * this.params.get('userParams');
* } * }

View File

@ -29,11 +29,11 @@ ionicBootstrap(E2EApp);
}) })
class LandingPage { class LandingPage {
constructor(private nav: NavController) { constructor(public navCtrl: NavController) {
} }
goToPage() { goToPage() {
this.nav.push(FirstPage); this.navCtrl.push(FirstPage);
} }
} }

View File

@ -15,10 +15,10 @@ import { ionicBootstrap, NavController } from '../../../../../src';
</ion-content>`, </ion-content>`,
}) })
class FirstPage { class FirstPage {
constructor(public nav: NavController) {} constructor(public navCtrl: NavController) {}
pushPage() { pushPage() {
this.nav.push(SecondPage); this.navCtrl.push(SecondPage);
} }
} }
@ -38,10 +38,10 @@ class FirstPage {
` `
}) })
class SecondPage { class SecondPage {
constructor(public nav: NavController) {} constructor(public navCtrl: NavController) {}
insertPage() { insertPage() {
this.nav.insert(1, InsertPage); this.navCtrl.insert(1, InsertPage);
} }
} }

View File

@ -52,14 +52,14 @@ class Page1 {
class Page2 { class Page2 {
tmr: number; tmr: number;
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
play() { play() {
this.tmr = setTimeout(() => { this.tmr = setTimeout(() => {
count++; count++;
console.log('pop', count); console.log('pop', count);
this.nav.pop({ this.navCtrl.pop({
animate: animate animate: animate
}); });
}, delay); }, delay);

View File

@ -17,10 +17,10 @@ import { Config, Nav, App } from '../../../../../src';
` `
}) })
export class Login { export class Login {
constructor(private nav: NavController, private app: App) {} constructor(public navCtrl: NavController, public app: App) {}
goToAccount() { goToAccount() {
this.nav.push(Account); this.navCtrl.push(Account);
} }
goBack() { goBack() {
@ -63,23 +63,23 @@ export class Account {
root = Dashboard; root = Dashboard;
constructor(private menu: MenuController, private app: App) {} constructor(public menuCtrl: MenuController, public app: App) {}
goToProfile() { goToProfile() {
this.accountNav.setRoot(Profile).then(() => { this.accountNav.setRoot(Profile).then(() => {
this.menu.close(); this.menuCtrl.close();
}); });
} }
goToDashboard() { goToDashboard() {
this.accountNav.setRoot(Dashboard).then(() => { this.accountNav.setRoot(Dashboard).then(() => {
this.menu.close(); this.menuCtrl.close();
}); });
} }
logOut() { logOut() {
this.accountNav.setRoot(Login, null, { animate: true }).then(() => { this.accountNav.setRoot(Login, null, { animate: true }).then(() => {
this.menu.close(); this.menuCtrl.close();
}); });
} }
@ -107,14 +107,14 @@ export class Account {
` `
}) })
export class Dashboard { export class Dashboard {
constructor(private nav: NavController, private app: App) {} constructor(public navCtrl: NavController, public app: App) {}
goToProfile() { goToProfile() {
this.nav.push(Profile); this.navCtrl.push(Profile);
} }
logOut() { logOut() {
this.nav.parent.setRoot(Login, null, { this.navCtrl.parent.setRoot(Login, null, {
animate: true, animate: true,
direction: 'back' direction: 'back'
}); });
@ -144,14 +144,14 @@ export class Dashboard {
` `
}) })
export class Profile { export class Profile {
constructor(private nav: NavController, private app: App) {} constructor(public navCtrl: NavController, public app: App) {}
goToDashboard() { goToDashboard() {
this.nav.push(Dashboard); this.navCtrl.push(Dashboard);
} }
logOut() { logOut() {
this.nav.parent.setRoot(Login, null, { this.navCtrl.parent.setRoot(Login, null, {
animate: true, animate: true,
direction: 'back' direction: 'back'
}); });

View File

@ -6,10 +6,10 @@ import { ionicBootstrap, NavController, NavParams } from '../../../../../src';
templateUrl: 'main.html' templateUrl: 'main.html'
}) })
class MainPage { class MainPage {
constructor(private _nav: NavController) { } constructor(public navCtrl: NavController) { }
goToSecond() { goToSecond() {
this._nav.push(SearchPage); this.navCtrl.push(SearchPage);
} }
} }
@ -19,12 +19,12 @@ class MainPage {
class SearchPage { class SearchPage {
items: string[]; items: string[];
constructor(private _nav: NavController) { constructor(public navCtrl: NavController) {
this.initializeItems(); this.initializeItems();
} }
showDetail(item: any) { showDetail(item: any) {
this._nav.push(DetailPage, {city: item}); this.navCtrl.push(DetailPage, {city: item});
} }
initializeItems() { initializeItems() {

View File

@ -8,12 +8,12 @@ import { ionicBootstrap, NavController } from '../../../../../src';
class SegmentPage { class SegmentPage {
signInType: string; signInType: string;
constructor(public nav: NavController) { constructor(public navCtrl: NavController) {
this.signInType = 'new'; this.signInType = 'new';
} }
goToPage2() { goToPage2() {
this.nav.push(SegmentPage2); this.navCtrl.push(SegmentPage2);
} }
} }

View File

@ -11,7 +11,7 @@ class IntroPage {
mySlideOptions: any; mySlideOptions: any;
showSlide: boolean = true; showSlide: boolean = true;
constructor(private nav: NavController) { constructor(public navCtrl: NavController) {
this.mySlideOptions = { this.mySlideOptions = {
paginationClickable: true, paginationClickable: true,
lazyLoading: true, lazyLoading: true,
@ -38,7 +38,7 @@ class IntroPage {
} }
skip() { skip() {
this.nav.push(MainPage); this.navCtrl.push(MainPage);
} }
} }

View File

@ -7,10 +7,10 @@ import { App, ionicBootstrap, NavController, NavParams, ModalController, ViewCon
templateUrl: './signIn.html' templateUrl: './signIn.html'
}) })
class SignIn { class SignIn {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
push() { push() {
this.nav.push(TabsPage, { this.navCtrl.push(TabsPage, {
userId: 8675309 userId: 8675309
}); });
} }
@ -21,7 +21,7 @@ class SignIn {
templateUrl: './modalChat.html' templateUrl: './modalChat.html'
}) })
class ChatPage { class ChatPage {
constructor(private viewCtrl: ViewController) {} constructor(public viewCtrl: ViewController) {}
ionViewLoaded() { ionViewLoaded() {
console.log('ChatPage, ionViewLoaded'); console.log('ChatPage, ionViewLoaded');
@ -92,17 +92,17 @@ class TabsPage {
class Tab1Page1 { class Tab1Page1 {
userId: string; userId: string;
constructor(private nav: NavController, private app: App, private tabs: Tabs, private params: NavParams) { constructor(public navCtrl: NavController, public app: App, public tabs: Tabs, public params: NavParams) {
this.userId = params.get('userId'); this.userId = params.get('userId');
} }
push() { push() {
this.nav.push(Tab1Page2); this.navCtrl.push(Tab1Page2);
} }
goBack() { goBack() {
console.log('go back begin'); console.log('go back begin');
this.nav.pop().then((val: any) => { this.navCtrl.pop().then((val: any) => {
console.log('go back completed', val); console.log('go back completed', val);
}); });
} }
@ -141,10 +141,10 @@ class Tab1Page1 {
templateUrl: './tab1page2.html' templateUrl: './tab1page2.html'
}) })
class Tab1Page2 { class Tab1Page2 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
push() { push() {
this.nav.push(Tab1Page3); this.navCtrl.push(Tab1Page3);
} }
ionViewWillEnter() { ionViewWillEnter() {
@ -173,7 +173,7 @@ class Tab1Page2 {
templateUrl: './tab1page3.html' templateUrl: './tab1page3.html'
}) })
class Tab1Page3 { class Tab1Page3 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
ionViewWillEnter() { ionViewWillEnter() {
console.log('Tab1Page3, ionViewWillEnter'); console.log('Tab1Page3, ionViewWillEnter');
@ -204,10 +204,10 @@ class Tab1Page3 {
templateUrl: './tab2page1.html' templateUrl: './tab2page1.html'
}) })
class Tab2Page1 { class Tab2Page1 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
push() { push() {
this.nav.push(Tab2Page2); this.navCtrl.push(Tab2Page2);
} }
ionViewWillEnter() { ionViewWillEnter() {
@ -236,10 +236,10 @@ class Tab2Page1 {
templateUrl: './tab2page2.html' templateUrl: './tab2page2.html'
}) })
class Tab2Page2 { class Tab2Page2 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
push() { push() {
this.nav.push(Tab2Page3); this.navCtrl.push(Tab2Page3);
} }
ionViewWillEnter() { ionViewWillEnter() {
@ -268,7 +268,7 @@ class Tab2Page2 {
templateUrl: './tab2page3.html' templateUrl: './tab2page3.html'
}) })
class Tab2Page3 { class Tab2Page3 {
constructor(private nav: NavController) {} constructor(public navCtrl: NavController) {}
ionViewWillEnter() { ionViewWillEnter() {
console.log('Tab2Page3, ionViewWillEnter'); console.log('Tab2Page3, ionViewWillEnter');

View File

@ -17,9 +17,7 @@ import { ionicBootstrap, NavController, Tab } from '../../../../../src';
</ion-content> </ion-content>
` `
}) })
class Tab1 { class Tab1 {}
constructor(public nav: NavController) {}
}
// //
// Tab 2 // Tab 2
@ -36,9 +34,7 @@ class Tab1 {
</ion-content> </ion-content>
` `
}) })
class Tab2 { class Tab2 {}
constructor(public nav: NavController) {}
}
// //
// Tab 3 // Tab 3
@ -58,9 +54,7 @@ class Tab2 {
</ion-content> </ion-content>
` `
}) })
class Tab3 { class Tab3 {}
constructor(public nav: NavController) {}
}
// //
// Tab 3 // Tab 3
@ -80,9 +74,7 @@ class Tab3 {
</ion-content> </ion-content>
` `
}) })
class QuesaritoPage { class QuesaritoPage {}
constructor(public nav: NavController) {}
}
@Component({ @Component({
template: ` template: `

View File

@ -22,7 +22,7 @@ class AnotherPage {}
}) })
class E2EPage { class E2EPage {
constructor(private toastCtrl: ToastController, private nav: NavController) { } constructor(public toastCtrl: ToastController, public navCtrl: NavController) { }
showToast() { showToast() {
const toast = this.toastCtrl.create({ const toast = this.toastCtrl.create({
@ -36,7 +36,7 @@ class E2EPage {
toast.present(); toast.present();
setTimeout(() => { setTimeout(() => {
this.nav.push(AnotherPage); this.navCtrl.push(AnotherPage);
}, 1000); }, 1000);
setTimeout(() => { setTimeout(() => {

View File

@ -8,7 +8,7 @@ import { NavController } from 'ionic-angular';
}) })
export class <%= jsClassName %> { export class <%= jsClassName %> {
constructor(private nav: NavController) { constructor(public navCtrl: NavController) {
// set the root pages for each tab // set the root pages for each tab
<% _.forEach(tabs, function(tab, i) { %>this.tab<%= ++i %>Root = <%= tab.jsClassName %>; <% _.forEach(tabs, function(tab, i) { %>this.tab<%= ++i %>Root = <%= tab.jsClassName %>;
<% }); %> <% }); %>