<div class="dropdown gt-dropdown">
  <button class="btn btn-default gtms-dropdown-toggle form-control" type="button">
    <span>{{buttonTitle}}</span>
    <span class="caret"></span>
  </button>
  <ul class="gt-dropdown dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
    <li ng-if="multiple" role="presentation">
      <a ng-click="aCheckAllClick($event)">
        <input type="checkbox" ng-model="$parent.allChecked" ng-click="iClick($event)"> {{ allChecked ? 'Uncheck All' : 'Check All' }}
      </a>
    </li>
    <li ng-if="multiple" role="presentation" class="divider"></li>

    <!-- multiple mode -->

    <li ng-if="multiple && groupedItems" role="presentation" class="dropdown-header" ng-repeat-start="(optGroup, opts) in groupedItems">{{optGroup}}</li>
    <li ng-if="multiple && groupedItems" role="presentation" ng-repeat-end ng-repeat="itm in opts">
      <a role="menuitem" tabindex="-1" ng-click="aClick($event, itm)">
        <input value="{{itm.value}}" ng-model="itm.checked" type="checkbox" name="{{inpName}}" ng-click="iClick($event)"> {{itm.label}}</a>
      </li>
    
    <li ng-if="multiple && items" role="presentation" ng-repeat="itm in items">
      <a role="menuitem" tabindex="-1" ng-click="aClick($event, itm)">
        <input value="{{itm.value}}" ng-model="itm.checked" type="checkbox" name="{{inpName}}" ng-click="iClick($event)"> {{itm.label}}</a>
      </li>

    <!-- single -->

    <li ng-if="!multiple">
      <a role="menuitem" tabindex="-1" ng-click="raNullClick($event)">
        <input value="" ng-model="$parent.singleResult" type="radio"> {{defaultButtonTitle}}</a>
    </li>

    <li ng-if="!multiple && groupedItems" role="presentation" class="dropdown-header" ng-repeat-start="(optGroup, opts) in groupedItems">{{optGroup}}</li>
    <li ng-if="!multiple && groupedItems" ng-repeat-end ng-repeat="itm in opts">
      <a role="menuitem" tabindex="-1" ng-click="raClick($event, itm)">
        <input value="{{itm.value}}" ng-model="$parent.$parent.singleResult" ng-click="raInpClick($event)" type="radio"> {{itm.label}}</a>
      </li>
    
    <li ng-if="!multiple && items" role="presentation" ng-repeat="itm in items">
      <a role="menuitem" tabindex="-1" ng-click="raClick($event, itm)">
        <input value="{{itm.value}}" ng-model="$parent.$parent.singleResult" ng-click="raInpClick($event)" type="radio"> {{itm.label}}</a>
      </li>      
    
  </ul>
</div>