javascript - catching Angular Bootstrap UI $uibModal closed event after the modal was closed -
i'm opening modal window using $uibmodal.open controller, , need notified when modal window closed (and not during closing...) i'll able run function.
the code opens modal follows:
var modalinstance = $uibmodal.open({ templateurl: "mymodalcontent.html", controller: "termmodalctrl", windowclass: 'app-modal-window', resolve: { 'params': function () { return id } } });
i saw suggested solutions use:
modalinstance.result.then(function(result) { });
the problem function callback called prior actual closing of modal window (when modal window still open) , not behavior want cause means catches "closing" event , not "closed" event of modal.
is there neat , simple way implement this? i'd surprised if not since behavior common in ui frameworks on planet...
please help!
try this.
.open
method returns promise chained .closed
1 of many properties of .open
method.
i tested , shows alert after modal has closed , not while it's 'closing'.
refer '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 plunker http://plnkr.co/edit/yb3k8e3r3zlqfq6sflyw?p=preview
Comments
Post a Comment