title: Execute function after $mddialog.cancel() finishes - AngularJS
body: <p>I've been looking at the documentation for $mdDialog.cancel() but haven't found how to call a function after if finishes. </p>
  
  <p>I want to do something like this</p>
  
  <pre><code>$mdDialog.cancel().then(function() {
      // Do some stuff in here
  });
  </code></pre>
  
  <p>Is this possible? </p>
  
  <p>I thought of making a seperate function that returned a promise but not sure how to do that,</p>
  
  <pre><code>closeDialog().then(function(){
      // Do something
  });
  
  closeDialog = function() {
      $mdDialog.cancel();
      return promise;
  }
  </code></pre>