code: function onRemove(scope, element, opts) {
        var animationRunner = null;
        var destroyListener = scope.$on('$destroy', function() {
          // Listen for the case where the element was destroyed while there was an
          // ongoing close animation. If this happens, we need to end the animation
          // manually.
          animationRunner.end();
        });
  
        opts = opts || { };
        opts.cleanupInteraction();
        opts.cleanupResizing();
        opts.hideBackdrop();
  
        // For navigation $destroy events, do a quick, non-animated removal,
        // but for normal closes (from clicks, etc) animate the removal
        return (opts.$destroy === true) ? cleanElement() : animateRemoval().then(cleanElement);
  
        /**
         * For normal closes (eg clicks), animate the removal.
         * For forced closes (like $destroy events from navigation),
         * skip the animations
         */
        function animateRemoval() {
          animationRunner = $animateCss(element, {addClass: 'md-leave'});
          return animationRunner.start();
        }
  
        /**
         * Restore the element to a closed state
         */
        function cleanElement() {
          destroyListener();
  
          element
            .removeClass('md-active')
            .attr('aria-hidden', 'true')
            .css('display', 'none');
          element.parent().find('md-select-value').removeAttr('aria-hidden');
  
          announceClosed(opts);
  
          if (!opts.$destroy && opts.restoreFocus) {
            opts.target.focus();
          }
        }
  
      }
docs: Interim-element onRemove logic....