catching Angular Bootstrap UI $uibModal closed event after the modal was closed
Try this.
.open
method returns a promise that could be chained with .closed
which is one of the many properties of .open
method.
I tested it and it shows the alert only after the modal has closed and not while it's 'closing'.
Refer the 'closed' under Return section here
var modalInstance = $uibModal.open({ templateUrl: "myModalContent.html", controller: "termModalCtrl", windowClass: 'app-modal-window', resolve: { 'params': function () { return id } }}).closed.then(function(){ window.alert('Modal closed');});
here is the plunker http://plnkr.co/edit/yB3k8e3R3ZLQFQ6sfLYW?p=preview
Use modalInstance.result
promise second callback to catch the closing event.I'm also getting exception 'Unable to get property 'then' of undefined or null reference' on .closed.then
,
var modalInstance = $uibModal.open({ templateUrl: "myModalContent.html", controller: "termModalCtrl", windowClass: 'app-modal-window', resolve: { 'params': function () { return id } }});modalInstance.result .then(function (selectedItem) { // }, function () { //close callback console.info('modal closed'); });