diff --git a/ionic/components/alert/test/dismiss/index.ts b/ionic/components/alert/test/dismiss/index.ts new file mode 100644 index 0000000000..85e10abee4 --- /dev/null +++ b/ionic/components/alert/test/dismiss/index.ts @@ -0,0 +1,59 @@ +import { Alert, NavController, App, Page } from 'ionic-angular/index'; + + +@Page({ + templateUrl: 'main.html' +}) +export class E2EPage { + + constructor(private nav: NavController) {} + + submit() { + var alert = Alert.create({ + title: 'Not logged in', + message: 'Sign in to continue.', + buttons: [ + { + text: 'Cancel', + role: 'cancel' + }, + { + text: 'Sign in', + handler: () => { + console.log('Sign in'); + } + } + ] + }); + + alert.onDismiss((asdf) => { + console.log('dismiss'); + this.nav.push(AnotherPage); + }); + + this.nav.present(alert); + } +} + +@Page({ + template: ` + + Another Page + + + Welcome! + + ` +}) +class AnotherPage {} + + +@App({ + template: '' +}) +class E2EApp { + root; + constructor() { + this.root = E2EPage; + } +} \ No newline at end of file diff --git a/ionic/components/alert/test/dismiss/main.html b/ionic/components/alert/test/dismiss/main.html new file mode 100644 index 0000000000..9cfa06a9e5 --- /dev/null +++ b/ionic/components/alert/test/dismiss/main.html @@ -0,0 +1,22 @@ + + + Alert Dismiss + + + + + + + + Input text here + + + + +
+ +
+ +
\ No newline at end of file diff --git a/ionic/components/nav/view-controller.ts b/ionic/components/nav/view-controller.ts index 062d745b84..b974b69fde 100644 --- a/ionic/components/nav/view-controller.ts +++ b/ionic/components/nav/view-controller.ts @@ -108,8 +108,10 @@ export class ViewController { } dismiss(data?: any, role?: any) { - this._onDismiss && this._onDismiss(data, role); - return this._nav.remove(this._nav.indexOf(this), 1, this._leavingOpts); + return this._nav.remove(this._nav.indexOf(this), 1, this._leavingOpts).then(() => { + this._onDismiss && this._onDismiss(data, role); + return data; + }); } /**