function OptgroupDirective() {
  return {
    restrict: 'E',
    compile: compile
  };
  function compile(el, attrs) {
    // If we have a select header element, we don't want to add the normal label
    // header.
    if (!hasSelectHeader()) {
      setupLabelElement();
    }

    function hasSelectHeader() {
      return el.parent().find('md-select-header').length;
    }

    function setupLabelElement() {
      var labelElement = el.find('label');
      if (!labelElement.length) {
        labelElement = angular.element('<label>');
        el.prepend(labelElement);
      }
      labelElement.addClass('md-container-ignore');
      labelElement.attr('aria-hidden', 'true');
      if (attrs.label) labelElement.text(attrs.label);
    }
  }
}
function OptgroupDirective() {
  return {
    restrict: 'E',
    compile: compile
  };
  function compile(el, attrs) {
    // If we have a select header element, we don't want to add the normal label
    // header.
    if (!hasSelectHeader()) {
      setupLabelElement();
    }

    function hasSelectHeader() {
      return el.parent().find('md-select-header').length;
    }

    function setupLabelElement() {
      var labelElement = el.find('label');
      if (!labelElement.length) {
        labelElement = angular.element('<label>');
        el.prepend(labelElement);
      }
      labelElement.addClass('md-container-ignore');
      labelElement.attr('aria-hidden', 'true');
      if (attrs.label) labelElement.text(attrs.label);
    }
  }
}
function OptgroupDirective ( ) { return { restrict : 'E' , compile : compile } ; function compile ( el , attrs ) { // If we have a select header element, we don't want to add the normal label // header. if ( ! hasSelectHeader ( ) ) { setupLabelElement ( ) ; } function hasSelectHeader ( ) { return el . parent ( ) . find ( 'md-select-header' ) . length ; } function setupLabelElement ( ) { var labelElement = el . find ( 'label' ) ; if ( ! labelElement . length ) { labelElement = angular . element ( '<label>' ) ; el . prepend ( labelElement ) ; } labelElement . addClass ( 'md-container-ignore' ) ; labelElement . attr ( 'aria-hidden' , 'true' ) ; if ( attrs . label ) labelElement . text ( attrs . label ) ; } } }
@ngdoc directive
@name mdOptgroup
@restrict E
@module material.components.select

@description Displays a label separating groups of
<a ng-href="/api/directive/mdOption">md-option</a> element directives in a
<a ng-href="/api/directive/mdSelect">md-select</a> box's dropdown menu.

**Note:** When using `md-select-header` element directives within a `md-select`, the labels that
would normally be added to the <a ng-href="/api/directive/mdOptgroup">md-optgroup</a> directives
are omitted, allowing the `md-select-header` to represent the option group label
(and possibly more).

@usage
With label attributes
<hljs lang="html">
<md-select ng-model="currentState" placeholder="Select a state">
<md-optgroup label="Southern">
<md-option ng-value="AL">Alabama</md-option>
<md-option ng-value="FL">Florida</md-option>
</md-optgroup>
<md-optgroup label="Northern">
<md-option ng-value="AK">Alaska</md-option>
<md-option ng-value="MA">Massachusetts</md-option>
</md-optgroup>
</md-select>
</hljs>

With label elements
<hljs lang="html">
<md-select ng-model="currentState" placeholder="Select a state">
<md-optgroup>
<label>Southern</label>
<md-option ng-value="AL">Alabama</md-option>
<md-option ng-value="FL">Florida</md-option>
</md-optgroup>
<md-optgroup>
<label>Northern</label>
<md-option ng-value="AK">Alaska</md-option>
<md-option ng-value="MA">Massachusetts</md-option>
</md-optgroup>
</md-select>
</hljs>

@param {string=} label The option group's label.
@ngdoc directive @name mdOptgroup @restrict E @module material . components . select
Optgroup directive.