Filter values in AngularJS selectize control?

761 views Asked by At

Is there a way to filter values in an AngularJS selectize control? I would like to be able to type in the selectize dropdown to filter my results. I know this is possible with the ui-select control, but since I'm returning a large amount of values, the selectize seems to offer greater performance, but I can't find the filtering capability of it (so far).

I'm using angular-selectize2, version 1.2.3 if that helps with any answers.

2

There are 2 answers

0
Dale On

Why not make a normal select menu and repeat the options based on a filtered dataset

<input type="text" ng-model="selectFilter" />
<select name="whatever">
    <option ng-repeat="option in options | filter:selectFilter" value="{{option.value}}">{{option.text}}</option>
</select>

This assumes the data for your options is in your controller

0
CurlyShuffle On

After some additional research, I believe I found the answer to my own question. Apparently in the $scope.myConfig section of the selectize, if you specify a "searchField," along with a value (ex: searchField: 'MyFieldName'), the filtering while typing in the selectize magically happens.

This Angular Selectize plunkr link provided the necessary answer for me: http://embed.plnkr.co/2lN4NRFN8VF6kUZqPs0M/