axel-zarate / js-custom-select

Custom auto-complete select box for AngularJS and Bootstrap
MIT License
68 stars 59 forks source link

Auto-complete works as contains text rather than starts with #35

Closed syedautherabbas closed 8 years ago

syedautherabbas commented 8 years ago

I believe the developer should be given a choice between the final search reg-exp , whether it can be "contains with" or "starts with"

axel-zarate commented 8 years ago

In version 1, filtering was performed inside the plugin's logic; that setting would make sense then. Starting in version 2, filtering is delegated to whatever filtering mechanism the coder chooses (filter or your own filtering function). Using filter:

<div custom-select="f for f in fruits | filter: $searchTerm" ng-model="fruit"></div>

Using a function:

<div custom-select="p as p.name for p in findPeople($searchTerm)" ng-model="people"></div>