code: function transitionOutAndRemove(response, isCancelled, opts) {
  
            // abort if the show() and compile failed
            if (!element) return $q.when(false);
  
            options = angular.extend(options || {}, opts || {});
            options.cancelAutoHide && options.cancelAutoHide();
            options.element.triggerHandler('$mdInterimElementRemove');
  
            if (options.$destroy === true) {
  
              return hideElement(options.element, options).then(function(){
                (isCancelled && rejectAll(response)) || resolveAll(response);
              });
  
            } else {
              $q.when(showAction).finally(function() {
                hideElement(options.element, options).then(function() {
                  isCancelled ? rejectAll(response) : resolveAll(response);
                }, rejectAll);
              });
  
              return self.deferred.promise;
            }
  
  
            /**
             * The `show()` returns a promise that will be resolved when the interim
             * element is hidden or cancelled...
             */
            function resolveAll(response) {
              self.deferred.resolve(response);
            }
  
            /**
             * Force the '$md<xxx>.show()' promise to reject
             */
            function rejectAll(fault) {
              self.deferred.reject(fault);
            }
          }
docs: After the show process has finished/rejected:
  - announce 'removing',
  - perform the transition-out, and
  - perform optional clean up scope.