mdDialog: No way to distinguish how a dialog was closed when closed automatically
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.
Definitely need to know if they clicked a button or backed out with click outside or escape.
This issue is closed as part of our ‘Surge Focus on Material 2' efforts. For details, see our forum posting @ http://bit.ly/1UhZyWs.