To close modal window one should call function modal.close(result).
close(result) - a method that can be used to close a modal, passing a result
What is result here?
What is the difference between close(true), close(false), close('blah-blah')>
Assuming you close the modal with something :
close(something)
You can get this something in the promise $modalInstance.result:
$modalInstance.result.then(function (something) {
// ...
}
See ui-bootstrap modal documentation and plunker for reference.
You can have your result of an operation at the modal back to the controller.
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
Look at this plunker link
resultpromise. This basically is a way to pass data back to the original caller of the modal service from the modal controller. Inspect the example script and play with it in the plunker link