Patrick Patrick - 10 months ago 63
jQuery Question

Execute function when modal is closed (Plunker attached)

I have a minor bug which i am not able to fix. Here is the plunker->

When the user opens the modal and makes selection, he chooses to close the modal by pressing 'Ok'

At this point of time, i want to execute ExecOnModalClose() function mentioned in the controller.

So, here is the code i tried.

$scope.ok = function() {

Execute this function below when user presses 'Ok' as shown above.

$scope.ExecOnModalClose = function() {
console.log("Execute this after modal closes on pressing Ok");

Can someone please let me know how to link these two.


You can use

<button class="btn btn-primary" type="button" ng-click="ok(); ExecOnModalClose()">OK</button>


after the change of the original plunker, using broadcasting seems to be the working solution: