3
How do I perform an action whenever the $uibModal
is closed?
Just to facilitate my learning, when I close the modal, I want to display a message.
For example:
angular.module('app', ['ui.bootstrap']).controller('TesteController', function ($scope, $uibModal) {
$scope.modal = function () {
var modal = $uibModal.open({
template: '<div class="modal-body">Olá mundo</div>'
});
// Como posso executar isso?
modal.quandoFechar(function () {
$scope.mensagem = 'Você fechou o modal';
});
};
})
The function modal.quandoFechar
obviously does not exist, but I want to know if there is any function that runs a callback when the $uibModalInstance
is closed.
In my case, I preferred to use the
finally
, because I was "wiping the data" when closing the modal. So regardless if it is "Dismiss" or "close", it performs what is infinally
.– Wallace Maxters