Rectangle 27 0

javascript How to detect closing a modal window in $modal angular ui?


$modal.open(tempModalDefaults).result
return $modal.open(tempModalDefaults).result.catch(function (reason) {
    // your code to handle rejection of the promise.
    if (reason === 'backdrop') {
        // do something
    }
});

is a promise. When the backdrop option is set to 'true', the promise will be rejected. You can can attach a rejection handler to that promise by using either the then method or the catch method which is shortcut:

Note