title: angular ui modal after close event return data object
body: <p>How can I get the event in the curtain outside the model so I can send data when closing the modal?</p>
  
  <p>This is what I'm doing, but I'm still not getting results. Look almost in every post and I did not find anything like it.</p>
  
  <p>This is the parent controller.</p>
  
  <pre><code>var modalInstance = $modal.open({
  templateUrl: 'myModalContent.html',
  controller: ModalInstanceCtrl,
  size: size,
  resolve: {
      items: function () {
        return $scope.items;
      }
   }
  });
  
   modalInstance.result.then(function (selectedItem) {
  $scope.selected = selectedItem;
   }, function (DateReceived) {
   console.log('Modal dismissed at: ' + new Date());
   console.log("Here I want to receive a parameter sent from the child controller.");
   console.log(DateReceived);
  });
  </code></pre>
  
  <p>Here I want to receive a parameter sent from the child controller: ModalInstanceCtrl.</p>
  
  <pre><code>$modalInstance.result.finally({
      DataSend: $scope.items
  });
  </code></pre>
  
  <p>Try to do it with this too and nothing.</p>
  
  <pre><code> $scope.$on('modal.closing', function(event, reason, closed) {
      if (reason == "backdrop click" || reason == "escape key press") {
          event.preventDefault();
          $modalInstance.close({
              DataSend: $scope.items
          });
      }
  });
  </code></pre>
  
  <p>And the $modalInstance.close({ DataSend: $scope.items }); is not working this shows me in the console <a href="https://i.stack.imgur.com/ROOLA.png" rel="nofollow noreferrer">result in the console</a></p>
  
  <p>I really do not know how to send and receive data when I close the model, which I think is wrong because I'm not getting results.</p>
  
  <p>Any help would be great. Thank you.</p>