diff --git a/ionic/components/action-sheet/action-sheet.ts b/ionic/components/action-sheet/action-sheet.ts index e680feaa1c..ef120f884d 100644 --- a/ionic/components/action-sheet/action-sheet.ts +++ b/ionic/components/action-sheet/action-sheet.ts @@ -12,9 +12,9 @@ import {Animation} from '../../animations/animation'; * @name ActionSheet * @description * The Action Sheet is a slide-up dialog that lets the user choose from a set - * of options. Dangerous options are made obvious. There are easy ways to - * cancel out of the action sheet, such as tapping the backdrop or even hitting - * escape key on desktop. + * of options. Dangerous (destructive) options are made obvious. There are easy + * ways to cancel out of the action sheet, such as tapping the backdrop or + * hitting the escape key on desktop. * * @usage * ```ts @@ -116,7 +116,7 @@ class ActionSheetCmp { } dismiss() { - this._viewCtrl.dismiss(this); + this._viewCtrl.dismiss(); } onPageLoaded() { @@ -129,10 +129,16 @@ class ActionSheetCmp { } if (button.style === 'cancel') { + if (!button.icon) { + button.icon = this._config.get('actionSheetCancelIcon'); + } this.d.cancelButton = button; } else { if (button.style === 'destructive') { + if (!button.icon) { + button.icon = this._config.get('actionSheetDestructiveIcon'); + } button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-destructive'; } buttons.push(button); diff --git a/ionic/components/action-sheet/test/basic/index.ts b/ionic/components/action-sheet/test/basic/index.ts index 914a20836f..937220297a 100644 --- a/ionic/components/action-sheet/test/basic/index.ts +++ b/ionic/components/action-sheet/test/basic/index.ts @@ -14,13 +14,14 @@ class E2EPage { this.result = ''; let actionSheet = ActionSheet.create({ + title: 'Modify your album', buttons: [ { - text: 'Cancel', - style: 'cancel', // will always sort to be on the bottom + text: 'Destructive', + style: 'destructive', handler: () => { - console.log('cancel this clicked'); - this.result = 'Canceled'; + console.log('Destructive clicked'); + this.result = 'Destructive'; } }, { @@ -40,11 +41,11 @@ class E2EPage { } }, { - text: 'Destructive', - style: 'destructive', + text: 'Cancel', + style: 'cancel', // will always sort to be on the bottom handler: () => { - console.log('Destructive clicked'); - this.result = 'Destructive'; + console.log('cancel this clicked'); + this.result = 'Canceled'; } } ] @@ -58,14 +59,6 @@ class E2EPage { let actionSheet = ActionSheet.create({ buttons: [ - { - text: 'Destructive', - style: 'destructive', - handler: () => { - console.log('Destructive clicked'); - this.result = 'Destructive'; - } - }, { text: 'Archive', handler: () => { @@ -80,6 +73,14 @@ class E2EPage { console.log('cancel this clicked'); this.result = 'Canceled'; } + }, + { + text: 'Destructive', + style: 'destructive', + handler: () => { + console.log('Destructive clicked'); + this.result = 'Destructive'; + } } ] }); diff --git a/ionic/components/alert/alert.ts b/ionic/components/alert/alert.ts index 2c72548249..7de574133b 100644 --- a/ionic/components/alert/alert.ts +++ b/ionic/components/alert/alert.ts @@ -111,7 +111,7 @@ class AlertCmp { } dismiss() { - this._viewCtrl.dismiss(this); + this._viewCtrl.dismiss(this.getValues()); } getValues() { diff --git a/ionic/components/alert/test/basic/index.ts b/ionic/components/alert/test/basic/index.ts index 752c0349de..64515192f3 100644 --- a/ionic/components/alert/test/basic/index.ts +++ b/ionic/components/alert/test/basic/index.ts @@ -86,6 +86,10 @@ class E2EPage { this.nav.present(alert).then(() => { this.testPromptOpen = true; }); + + alert.onDismiss(data => { + console.log('onDismiss data', data); + }); } } diff --git a/ionic/components/nav/view-controller.ts b/ionic/components/nav/view-controller.ts index 34aefa93b4..8467f8f2a3 100644 --- a/ionic/components/nav/view-controller.ts +++ b/ionic/components/nav/view-controller.ts @@ -45,6 +45,11 @@ export class ViewController { this._onDismiss = callback; } + dismiss(data) { + this._onDismiss && this._onDismiss(data); + return this._nav.remove(this._nav.indexOf(this), this._leavingOpts); + } + setNav(navCtrl) { this._nav = navCtrl; } @@ -57,11 +62,6 @@ export class ViewController { return new NavParams(this.data); } - dismiss(data) { - this._onDismiss && this._onDismiss(data); - return this._nav.remove(this._nav.indexOf(this), this._leavingOpts); - } - setLeavingOpts(opts) { this._leavingOpts = opts; }