wr-angular-select

angular select directive based on select2

Usage no npm install needed!

<script type="module">
  import wrAngularSelect from 'https://cdn.skypack.dev/wr-angular-select';
</script>

README

wr-angular-select

angular select widget based on jQuery select2 and select2 bootstrap css

Dependencies

Install

npm install wr-angular-select

Usage

.....
<!-- select2.css and bootstrap-select2.css -->
<script src="..../angular-clickout/angular-clickout.min.js"></script>
<script src="wr-angular-select/dist/wr-angular-select.min.js"></script>
.....

<wr-select data-ng-model="myModel" 
           data-options="myOptions" <!-- array or promise -->
           data-search="searchText" <!-- optional -->
           data-placeholder="placeholder" <!-- optional, default "Select" -->
           data-label="labelProp" <!-- default 'label' -->
           data-value="valueProp" <!-- default 'value', if set to "", then ng-model will be set to option object --> ></wr-select>
angular.module('myApp', ['wr-select'])

Async search

It is possible to pass promise in options to wr-select, e.g. on change search text. It will handle this promise.

TODO:

  • multiselect