-
Notifications
You must be signed in to change notification settings - Fork 6
Documentation
Alex Cheuk edited this page Jul 29, 2016
·
8 revisions
<reselect
ng-model="simple.value">
<reselect-choices options="option in array">
<span ng-bind-html="option | rshighlight : $reselect.search_term"></span>
</reselect-choices>
</reselect>reselect is the main directive
<reselect="scope.options" ng-model="scope.value" [attributes]></reselect>| option | description | type | default |
|---|---|---|---|
allow-clear |
Display a clear button if true
|
Boolean | false |
placeholder |
Placeholder text when no value is selected | String | 'Please select an option' |
reselect-options |
An object of reselect options | Object | {} |
ng-disabled |
Disable Reselect if true
|
Boolean | false |
ng-required |
Make Reselect required if true
|
Boolean | false |
ng-change |
Run a function when user selects a value | Function |
Reselect Options
These are the available options for reselect="options"
| attr | description | type | default |
|---|---|---|---|
| allowClear | Display a clear button if true
|
Boolean | false |
| allowInvalid | If a function is defined, the function will be called when reselect's model value gets changed to a value that does not exist in the choices. |
Function | |
| Allow invalid example |
{
allowInvalid: function(invalidValue, done){
// This function will call when an invalid value is detected
if(invalidValue === 'Resolvable Value'){
done('Resolved Value');
}else{
done(null);
}
}
}reselect-choices is a directive that handles the choices for reselect
Array of value
<reselect>
<div reselect-choices="scope.options"
options="item in array">
<span ng-bind="item"></span>
<div>
</reselect>Array of object
<!-- model value is an object -->
<reselect>
<div reselect-choices="scope.options"
options="item in objects">
<span ng-bind="item.firstName + item.lastName"></span>
<div>
</reselect>
<!-- model value is an id -->
<reselect>
<div reselect-choices="scope.options"
options="item.id as item in objects track by id">
<span ng-bind="item.firstName + item.lastName"></span>
<div>
</reselect>Remote Fetching
<reselect>
<div reselect-choices
remote="scope.remoteOptions"
options="item in $remote">
<span ng-bind="item.text"></span>
<div>
</reselect>| attr | description | type | default |
|---|---|---|---|
reselect-choices |
Options object for reselect-choices
|
object | |
options |
Angular expression for repeating choices | expression | |
remote |
Options to fetch choices from remote data | object |