form_select.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <div class="bg-light lter b-b wrapper-md">
  2. <h1 class="m-n font-thin h3">UI Selects</h1>
  3. </div>
  4. <div class="wrapper-md">
  5. <form class="form-horizontal">
  6. <fieldset>
  7. <div class="form-group">
  8. <label class="col-sm-3 control-label text-left">Address</label>
  9. <div class="col-sm-6">
  10. <ui-select ng-model="address.selected"
  11. theme="bootstrap"
  12. ng-disabled="disabled"
  13. reset-search-input="false"
  14. style="width: 300px;">
  15. <ui-select-match placeholder="Enter an address...">{{$select.selected.formatted_address}}</ui-select-match>
  16. <ui-select-choices repeat="address in addresses track by $index"
  17. refresh="refreshAddresses($select.search)"
  18. refresh-delay="0">
  19. <div ng-bind-html="address.formatted_address | highlight: $select.search"></div>
  20. </ui-select-choices>
  21. </ui-select>
  22. <span class="help-block">{{address.selected.formatted_address}}</span>
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. <label class="col-sm-3 control-label text-left">Default</label>
  27. <div class="col-sm-6">
  28. <ui-select ng-model="person.selected" theme="bootstrap">
  29. <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
  30. <ui-select-choices repeat="item in people | filter: $select.search">
  31. <div ng-bind-html="item.name | highlight: $select.search"></div>
  32. <small ng-bind-html="item.email | highlight: $select.search"></small>
  33. </ui-select-choices>
  34. </ui-select>
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="col-sm-3 control-label text-left">Grouped</label>
  39. <div class="col-sm-6">
  40. <ui-select ng-model="person.selected" theme="bootstrap">
  41. <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
  42. <ui-select-choices group-by="'group'" repeat="item in people | filter: $select.search">
  43. <span ng-bind-html="item.name | highlight: $select.search"></span>
  44. <small ng-bind-html="item.email | highlight: $select.search"></small>
  45. </ui-select-choices>
  46. </ui-select>
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-3 control-label text-left">Grouped using a string</label>
  51. <div class="col-sm-6">
  52. <ui-select ng-model="person.selected" theme="bootstrap" ng-disabled="disabled" style="min-width: 300px;">
  53. <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
  54. <ui-select-choices group-by="'country'" repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
  55. <div ng-bind-html="person.name | highlight: $select.search"></div>
  56. <small>
  57. email: {{person.email}}
  58. age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
  59. </small>
  60. </ui-select-choices>
  61. </ui-select>
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <label class="col-sm-3 control-label text-left">Group using a function</label>
  66. <div class="col-sm-6">
  67. <ui-select ng-model="person.selected" theme="bootstrap" ng-disabled="disabled" style="min-width: 300px;">
  68. <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
  69. <ui-select-choices group-by="someGroupFn" repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
  70. <div ng-bind-html="person.name | highlight: $select.search"></div>
  71. <small>
  72. email: {{person.email}}
  73. age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
  74. </small>
  75. </ui-select-choices>
  76. </ui-select>
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="col-sm-3 control-label text-left">With a clear button</label>
  81. <div class="col-sm-6">
  82. <div class="input-group">
  83. <ui-select ng-model="person.selected" theme="bootstrap">
  84. <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
  85. <ui-select-choices repeat="item in people | filter: $select.search">
  86. <span ng-bind-html="item.name | highlight: $select.search"></span>
  87. <small ng-bind-html="item.email | highlight: $select.search"></small>
  88. </ui-select-choices>
  89. </ui-select>
  90. <span class="input-group-btn">
  91. <button ng-click="person.selected = undefined" class="btn btn-default">
  92. <span class="glyphicon glyphicon-trash"></span>
  93. </button>
  94. </span>
  95. </div>
  96. </div>
  97. </div>
  98. <div class="form-group">
  99. <label class="col-sm-3 control-label text-left">Multiple</label>
  100. <div class="col-sm-6">
  101. <ui-select multiple ng-model="multipleDemo.selectedPeopleWithGroupBy" theme="bootstrap" ng-disabled="disabled">
  102. <ui-select-match placeholder="Select person...">{{$item.name}} &lt;{{$item.email}}&gt;</ui-select-match>
  103. <ui-select-choices group-by="someGroupFn" repeat="person in people | propsFilter: {name: $select.search, age: $select.search}">
  104. <div ng-bind-html="person.name | highlight: $select.search"></div>
  105. <small>
  106. email: {{person.email}}
  107. age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
  108. </small>
  109. </ui-select-choices>
  110. </ui-select>
  111. </div>
  112. </div>
  113. <div class="form-group">
  114. <label class="col-sm-3 control-label text-left">Disabled</label>
  115. <div class="col-sm-6">
  116. <ui-select ng-model="person.selected" theme="bootstrap" ng-disabled="true">
  117. <ui-select-match placeholder="Select or search a person in the list...">{{$select.selected.name}}</ui-select-match>
  118. <ui-select-choices repeat="item in people | filter: $select.search">
  119. <div ng-bind-html="item.name | highlight: $select.search"></div>
  120. <small ng-bind-html="item.email | highlight: $select.search"></small>
  121. </ui-select-choices>
  122. </ui-select>
  123. </div>
  124. </div>
  125. </fieldset>
  126. </form>
  127. </div>