<div class="bg-light lter b-b wrapper-md">
  <h1 class="m-n font-thin h3">UI Selects</h1>
</div>
<div class="wrapper-md">
  <form class="form-horizontal">
    <fieldset>
      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Address</label>
        <div class="col-sm-6">

          <ui-select ng-model="address.selected"
                     theme="bootstrap"
                     ng-disabled="disabled"
                     reset-search-input="false"
                     style="width: 300px;">
            <ui-select-match placeholder="Enter an address...">{{$select.selected.formatted_address}}</ui-select-match>
            <ui-select-choices repeat="address in addresses track by $index"
                     refresh="refreshAddresses($select.search)"
                     refresh-delay="0">
              <div ng-bind-html="address.formatted_address | highlight: $select.search"></div>
            </ui-select-choices>
          </ui-select>
          <span class="help-block">{{address.selected.formatted_address}}</span>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Default</label>
        <div class="col-sm-6">

          <ui-select ng-model="person.selected" theme="bootstrap">
            <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices repeat="item in people | filter: $select.search">
              <div ng-bind-html="item.name | highlight: $select.search"></div>
              <small ng-bind-html="item.email | highlight: $select.search"></small>
            </ui-select-choices>
          </ui-select>

        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Grouped</label>
        <div class="col-sm-6">

          <ui-select ng-model="person.selected" theme="bootstrap">
            <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices group-by="'group'" repeat="item in people | filter: $select.search">
              <span ng-bind-html="item.name | highlight: $select.search"></span>
              <small ng-bind-html="item.email | highlight: $select.search"></small>
            </ui-select-choices>
          </ui-select>

        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Grouped using a string</label>
        <div class="col-sm-6">

          <ui-select ng-model="person.selected" theme="bootstrap" ng-disabled="disabled" style="min-width: 300px;">
            <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices group-by="'country'" repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
              <div ng-bind-html="person.name | highlight: $select.search"></div>
              <small>
                email: {{person.email}}
                age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
              </small>
            </ui-select-choices>
          </ui-select>

        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Group using a function</label>
        <div class="col-sm-6">

          <ui-select ng-model="person.selected" theme="bootstrap" ng-disabled="disabled" style="min-width: 300px;">
            <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices group-by="someGroupFn" repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
              <div ng-bind-html="person.name | highlight: $select.search"></div>
              <small>
                email: {{person.email}}
                age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
              </small>
            </ui-select-choices>
          </ui-select>

        </div>
      </div>        

      <div class="form-group">
        <label class="col-sm-3 control-label text-left">With a clear button</label>
        <div class="col-sm-6">
          <div class="input-group">

            <ui-select ng-model="person.selected" theme="bootstrap">
              <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
              <ui-select-choices repeat="item in people | filter: $select.search">
                <span ng-bind-html="item.name | highlight: $select.search"></span>
                <small ng-bind-html="item.email | highlight: $select.search"></small>
              </ui-select-choices>
            </ui-select>

            <span class="input-group-btn">
              <button ng-click="person.selected = undefined" class="btn btn-default">
                <span class="glyphicon glyphicon-trash"></span>
              </button>
            </span>

          </div>
        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Multiple</label>
        <div class="col-sm-6">

          <ui-select multiple ng-model="multipleDemo.selectedPeopleWithGroupBy" theme="bootstrap" ng-disabled="disabled">
            <ui-select-match placeholder="Select person...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match>
            <ui-select-choices group-by="someGroupFn" repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
              <div ng-bind-html="person.name | highlight: $select.search"></div>
              <small>
                email: {{person.email}}
                age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
              </small>
            </ui-select-choices>
          </ui-select>

        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-3 control-label text-left">Disabled</label>
        <div class="col-sm-6">

          <ui-select ng-model="person.selected" theme="bootstrap" ng-disabled="true">
            <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
            <ui-select-choices repeat="item in people | filter: $select.search">
              <div ng-bind-html="item.name | highlight: $select.search"></div>
              <small ng-bind-html="item.email | highlight: $select.search"></small>
            </ui-select-choices>
          </ui-select>

        </div>
      </div>

    </fieldset>
  </form>
</div>