diff --git a/src/components/loading/test/basic/app-module.ts b/src/components/loading/test/basic/app-module.ts index 2a5bf713a9..d712a4a02c 100644 --- a/src/components/loading/test/basic/app-module.ts +++ b/src/components/loading/test/basic/app-module.ts @@ -1,5 +1,5 @@ import { Component, ViewEncapsulation, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, LoadingController, NavController } from '../../../..'; +import { App, IonicApp, IonicModule, LoadingController, NavController } from '../../../..'; @Component({ @@ -242,6 +242,18 @@ export class E2EPage { }, 500); } + + presentLoadingDismissNav() { + this.loadingCtrl.create({ + spinner: 'hide', + content: 'Loading 1 Please Wait...', + dismissOnPageChange: true + }).present(); + + setTimeout(() => { + this.navCtrl.push(Page2); + }, 500); + } } @Component({ @@ -255,7 +267,7 @@ export class E2EPage { - @@ -267,12 +279,6 @@ export class E2EPage { export class Page2 { constructor(public navCtrl: NavController) {} - ionViewDidLoad() { - setTimeout(() => { - this.navCtrl.push(Page3); - }, 1000); - } - goToPage3() { this.navCtrl.push(Page3); } @@ -298,6 +304,16 @@ export class Page3 {} }) export class E2EApp { root = E2EPage; + + constructor(app: App) { + app.viewDidLeave.subscribe(ev => { + console.log('App didLeave'); + }); + + app.viewWillLeave.subscribe(ev => { + console.log('App willLeave'); + }); + } } @NgModule({ diff --git a/src/components/loading/test/basic/main.html b/src/components/loading/test/basic/main.html index 0e67e1549a..4f86675fe4 100644 --- a/src/components/loading/test/basic/main.html +++ b/src/components/loading/test/basic/main.html @@ -21,6 +21,7 @@ + diff --git a/src/components/nav/overlay-portal.ts b/src/components/nav/overlay-portal.ts index 3bdc6d1d7d..4907cf8ec9 100644 --- a/src/components/nav/overlay-portal.ts +++ b/src/components/nav/overlay-portal.ts @@ -37,7 +37,9 @@ export class OverlayPortal extends NavControllerBase { // on every page change make sure the portal has // dismissed any views that should be auto dismissed on page change - app.viewDidLeave.subscribe(this.dismissPageChangeViews.bind(this)); + app.viewDidLeave.subscribe((ev) => { + !ev.isOverlay && this.dismissPageChangeViews(); + }); } @Input('overlay-portal') diff --git a/src/components/toast/test/basic/app-module.ts b/src/components/toast/test/basic/app-module.ts index 7a44a06b4b..f2904fde47 100644 --- a/src/components/toast/test/basic/app-module.ts +++ b/src/components/toast/test/basic/app-module.ts @@ -75,6 +75,19 @@ export class E2EPage { toast.present(); } + showDismissPageChangeToast() { + const toast = this.toastCtrl.create({ + message: 'I am dismissed on page change', + dismissOnPageChange: true + }); + toast.onDidDismiss(this.dismissHandler); + toast.present(); + + setTimeout(() => { + this.navCtrl.push(AnotherPage); + }, 1000); + } + private dismissHandler(toast: Toast) { console.info('Toast onDidDismiss()'); } diff --git a/src/components/toast/test/basic/main.html b/src/components/toast/test/basic/main.html index 70ba37f984..35f0af8d41 100644 --- a/src/components/toast/test/basic/main.html +++ b/src/components/toast/test/basic/main.html @@ -11,6 +11,7 @@ +