angularjs - How to do something when an AngularUI's modal is closed? -


i'm working angularui's modal, , change variable of controller when modal closed.

my modal looks this:

<div class="modal fade" id="awesomemodal" role="dialog">     ...     <button type"button" data-dismiss="modal">close</button> </div> 

i guess close event of modal has data-dismiss, don't find yet how @ specific moment.


what set $scope.finished = true; when modal closed.

i know can <button type"button" data-dismiss="modal" ng-click="finished = false>close</button>, there is, in opinion, cleaner way it.

since asking $uibmodal, here event can used capture modal close event:

                var modalinstance = $uibmodal.open({                     templateurl: 'modules/alerttemplates/redirecttomodal.html',                     controller: 'redirecttocontroller',                     controlleras: 'redirecttocontrollervm',                     keyboard: false                     }                 });                  modalinstance.result.then(function () {                     // called when close modal                     // stuff                 }, function () {                     // called when dismiss modal clicking anywhere outside modal                     // stuff                 }); 

also, if want can give modal template inline using template instead of templateurl. refer following link better explanation , syntax:

https://github.com/angular-ui/bootstrap/tree/master/src/modal/docs 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -