I did some more research, and I found another question similar to this one, this is the answer found on that question (feel free to +1 him, and not me)
$scope.$on('modal.closing', function(event, reason, closed) {
var r = prompt("Are you sure you wanna close the modal? (Enter 'YES' to close)");
if (r !== 'YES') {
event.preventDefault();
}
});
Put this inside the modal controller.
This is not exactly what you searched for, this will prompt you if you try to close the modal, by dismiss (clicking outside modal), cancel or ok button. You can try and modify it to suit your needs.
Update: Added simple if else
check to see what was clicked, and if backdrop was clicked then prompt the user:
$scope.$on('modal.closing', function(event, reason, closed) {
if (reason == 'ok' || reason == 'cancel'){
console.log('closed');
} else {
// this is if 'reason' == 'backdrop click'
var r = prompt("Are you sure you wanna close the modal? (Enter 'YES' to close)");
if (r !== 'YES') {
event.preventDefault();
}
}
});
Do you think this solution is sufficient?