src/components/menu/js/menuServiceProvider.js
function captureClickListener(e) {
          var target = e.target;
          // Traverse up the event until we get to the menuContentEl to see if
          // there is an ng-click and that the ng-click is not disabled
          do {
            if (target == opts.menuContentEl[0]) return;
            if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) ||
                target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) {
              var closestMenu = $mdUtil.getClosest(target, 'MD-MENU');
              if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) {
                close();
              }
              break;
            }
          } while (target = target.parentNode);

          function close() {
            scope.$apply(function() {
              opts.mdMenuCtrl.close(true, { closeAll: true });
            });
          }

          function hasAnyAttribute(target, attrs) {
            if (!target) return false;

            for (var i = 0, attr; attr = attrs[i]; ++i) {
              if (prefixer.hasAttribute(target, attr)) {
                return true;
              }
            }

            return false;
          }
        }
function captureClickListener(e) {
          var target = e.target;
          // Traverse up the event until we get to the menuContentEl to see if
          // there is an ng-click and that the ng-click is not disabled
          do {
            if (target == opts.menuContentEl[0]) return;
            if ((hasAnyAttribute(target, ['ng-click', 'ng-href', 'ui-sref']) ||
                target.nodeName == 'BUTTON' || target.nodeName == 'MD-BUTTON') && !hasAnyAttribute(target, ['md-prevent-menu-close'])) {
              var closestMenu = $mdUtil.getClosest(target, 'MD-MENU');
              if (!target.hasAttribute('disabled') && (!closestMenu || closestMenu == opts.parent[0])) {
                close();
              }
              break;
            }
          } while (target = target.parentNode);

          function close() {
            scope.$apply(function() {
              opts.mdMenuCtrl.close(true, { closeAll: true });
            });
          }

          function hasAnyAttribute(target, attrs) {
            if (!target) return false;

            for (var i = 0, attr; attr = attrs[i]; ++i) {
              if (prefixer.hasAttribute(target, attr)) {
                return true;
              }
            }

            return false;
          }
        }
function captureClickListener ( e ) { var target = e . target ; // Traverse up the event until we get to the menuContentEl to see if // there is an ng-click and that the ng-click is not disabled do { if ( target == opts . menuContentEl [ 0 ] ) return ; if ( ( hasAnyAttribute ( target , [ 'ng-click' , 'ng-href' , 'ui-sref' ] ) || target . nodeName == 'BUTTON' || target . nodeName == 'MD-BUTTON' ) && ! hasAnyAttribute ( target , [ 'md-prevent-menu-close' ] ) ) { var closestMenu = $mdUtil . getClosest ( target , 'MD-MENU' ) ; if ( ! target . hasAttribute ( 'disabled' ) && ( ! closestMenu || closestMenu == opts . parent [ 0 ] ) ) { close ( ) ; } break ; } } while ( target = target . parentNode ) ; function close ( ) { scope . $apply ( function ( ) { opts . mdMenuCtrl . close ( true , { closeAll : true } ) ; } ) ; } function hasAnyAttribute ( target , attrs ) { if ( ! target ) return false ; for ( var i = 0 , attr ; attr = attrs [ i ] ; ++ i ) { if ( prefixer . hasAttribute ( target , attr ) ) { return true ; } } return false ; } }
Close menu on menu item click, if said menu-item is not disabled
Close menu on menu item click if said menu - item is not disabled