#oi.select β AngularJS directive of select element
Features
- multiselect
- API compatible with Angular select
- Angular 1.2+ without jQuery and other dependencies
- search options by substring (including the search query to the server)
- use Bootstrap styles (but you can use own styles)
- 17 KB minified
Demo
Do you want to see module in action? Visit tamtakoe.github.io/oi.select or try playground
Installation
You can download files through Bower:
npm install -g bower bower install oi.select or use npm:
npm install --save oi.select or use local:
npm install npm install -g bower npm install -g gulp bower install run local:
gulp open "http://localhost:3000" make build and run tests:
gulp build gulp test Then you need to include into index.html:
select.min.css select.min.js or select-tpls.min.js When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the oi.select AngularJS module:
angular.module('myModule', ['oi.select']);Use oi-select directive:
<oi-select oi-options="item.name for item in shopArr track by item.id" ng-model="bundle" multiple placeholder="Select" ></oi-select>Attributes
oi-select directive
oi-optionsβ see: ngOptionsoi-options="item for item in shopArrShort | limitTo: 3"β filter input listoi-options="item for item in shopArrFn($query, $selectedAs)"β generate input list (expects array/object or promise)
ng-modelβ chosen item/itemsng-disabledβ specifies that a drop-down list should be disabledmultipleβ specifies that multiple options can be selected at oncemultiple-limitβ maximum number of options that can be selected at onceplaceholderβ native placeholdermultiple-placeholderβ placeholder which is shown in multiple mode near chosen optionslist-placeholderβ placeholder which is shown in list if no elements foundreadonlyβ specifies that an input field is read-onlyautofocusβ specifies that an input field should automatically get focus when the page loadsoi-select-optionsβ object with options. You can override them inoiSelectProvider.optionsdebounceβ timeout of debounced input field (default: 500). Set only ifvalueis function which return promisesearchFilterβ filter name for items in search fielddropdownFilterβ filter name for items in dropdowngroupFilterβ filter name for group headerlistFilterβ filter name for items order in dropdown. Usenoneto disable filtering. You can set special options (see Filtered example)editItemβ function which getlastQuery,removedItemandgetLabel(item)and return string for input after element was removed (default: '').editItem = trueallows you to edit a deleted item.editItem = 'correct'same astruebut does not edit the first timesaveTriggerβ Trigger on which element is stored in the model. May beenter,blur,space,taband any characters devided by spaces (default:enter tab blur)cleanModelβ Clean model on click for single select.closeListβ close dropdown list by default after choosing or removing item (default: true)newItemβ Mode of adding new items from query (default: false). May beautocomplete(priority save matches),prompt(priority save new item)newItemModelβ New items model (default: model = query).$queryvalue from model will be changed to query string.newItemFnβ function which get query and return new item object or promise. F.e.'addItem($query)'removeItemFnβ function which get removed item model and return any value or promise. If promise was rejected, item wouldn't removed. F.e.'removeItem($item)'maxlengthβ maximum number of characters allowed in the inputminlengthβ minimum number of characters for searching
oiSelect service
optionsβ default options which we can override inoiSelectProvider.optionsversionβ current version