material icon indicating copy to clipboard operation
material copied to clipboard

mdDialog: No way to distinguish how a dialog was closed when closed automatically

Open dave-gray101 opened this issue 10 years ago • 2 comments

Dialogs configured with the clickOutsideToClose or escapeToClose parameters set equal to true can close themselves if the user clicks outside or presses escape. Unfortunately, in both of these cases, the promise returned by $mdDialog is resolved (in the case of alert dialogs) or rejected (in the case of other dialogs) without providing a value. This prevents the calling application from identifying the exact code path that cause the dialog to be closed.

I will be submitting a pull request shortly to address this shortcoming. My proposed solution is a simple extension to the existing clickOutsideToClose and escapeToClose parameters. If those parameters are set to true or false, their behavior will be unchanged. If one of those parameters is set to any other truthy value, that value will be used to resolve or reject the promise.

dave-gray101 avatar Mar 24 '16 15:03 dave-gray101

Definitely need to know if they clicked a button or backed out with click outside or escape.

sdesmond avatar Apr 10 '16 03:04 sdesmond

This issue is closed as part of our ‘Surge Focus on Material 2' efforts. For details, see our forum posting @ http://bit.ly/1UhZyWs.

ThomasBurleson avatar Jun 02 '16 07:06 ThomasBurleson