mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
@@ -1,4 +1,5 @@
|
||||
import {App, IonicApp, MenuController, Page, NavController, Alert} from '../../../../../src';
|
||||
import {ViewChild} from '@angular/core';
|
||||
import {App, IonicApp, MenuController, Page, NavController, Alert, Nav} from '../../../../../src';
|
||||
|
||||
|
||||
@Page({
|
||||
@@ -16,6 +17,10 @@ class Page1 {
|
||||
});
|
||||
this.nav.present(alert);
|
||||
}
|
||||
|
||||
goToPage2() {
|
||||
this.nav.push(Page2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +45,7 @@ class E2EApp {
|
||||
rootPage;
|
||||
changeDetectionCount: number = 0;
|
||||
pages: Array<{title: string, component: any}>;
|
||||
@ViewChild(Nav) nav: Nav;
|
||||
|
||||
constructor(private app: IonicApp, private menu: MenuController) {
|
||||
this.rootPage = Page1;
|
||||
@@ -54,8 +60,7 @@ class E2EApp {
|
||||
openPage(page) {
|
||||
// Reset the content nav to have just this page
|
||||
// we wouldn't want the back button to show in this scenario
|
||||
let nav = this.app.getComponent('nav');
|
||||
nav.setRoot(page.component).then(() => {
|
||||
this.nav.setRoot(page.component).then(() => {
|
||||
// wait for the root page to be completely loaded
|
||||
// then close the menu
|
||||
this.menu.close();
|
||||
|
||||
@@ -138,6 +138,6 @@
|
||||
|
||||
</ion-menu>
|
||||
|
||||
<ion-nav id="nav" [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>
|
||||
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
|
||||
|
||||
<div [hidden]="isChangeDetecting()"></div>
|
||||
@@ -51,6 +51,10 @@
|
||||
<button (click)="presentAlert()">Open alert</button>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button (click)="goToPage2()">Go to Page 2</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>
|
||||
|
||||
</ion-content>
|
||||
|
||||
Reference in New Issue
Block a user