#vercryger:oi.select
An AngularJS directive of multiselect elements for angular-meteor applications.
- multiselect
- API compatible with Angular select
- Meteor 0.9+
- 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)
In your Meteor app directory, enter:
meteor add vercryger:oi.select
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>
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 oncereadonly
— 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.options
debounce
— timeout of debounced input field (default: 500). Set only ifvalue
is function which return promisesearchFilter
— filter name for items in search fielddropdownFilter
— filter name for items in dropdownlistFilter
— filter name for items order in dropdown. Usenone
to disable filteringeditItem
— function which getlastQuery
,removedItem
andgetLabel(item)
and return string for input after element was removed (default: '').editItem = true
allows you to edit a deleted item.editItem = 'correct'
same astrue
but does not edit the first timesaveTrigger
— Trigger on which element is stored in the model. May beenter
,blur
,space
,tab
and 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).$query
value 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)'
options
— default options which we can override inoiSelectProvider.options
version
— current version
Do you want to see module in action?
git clone https://github.com/Vercryger/oi.select.git
cd meteor-angular-example
meteor