<div class="form-group">
  <label class="control-label col-sm-2">
    Roles
  </label>
  <div class="col-sm-10">
    <div class="input-group">
      <input type="text" ng-model="authority.selectedRole" placeholder="Role Name"
             uib-typeahead="role.name for role in roleService.findRoleByName($viewValue)" typeahead-loading="loadingAccounts"
             class="form-control input-md" typeahead-on-select="authority.attachRole($item)" typeahead-wait-ms="500"
             uib-tooltip="These are the User roles you wish to associated with your authority"
             tooltip-trigger="focus" tooltip-placement="top">
      <span class="input-group-btn">
        <button ng-model="roles.show" class="btn btn-md btn-default" uib-btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0">
          <span class="badge">{{ authority.roles.length || 0 }}</span>
        </button>
      </span>
    </div>
    <table ng-show="roles.show" class="table">
      <tr ng-repeat="role in authority.roles track by $index">
        <td><a class="btn btn-sm btn-info" href="#/accounts/{{ account.id }}/certificates">{{ role.name }}</a></td>
        <td><span class="text-muted">{{ role.description }}</span></td>
        <td>
          <button type="button" ng-click="authority.removeRole($index)" class="btn btn-danger btn-sm pull-right">Remove</button>
        </td>
      </tr>
    </table>
  </div>
</div>
