searchable drop down in AngularJs

Usman I picture Usman I · Sep 16, 2016 · Viewed 53.5k times · Source

I am fetching data from API and I need a searchable dropdown so that when I start typing it shows me the data coming from the API. Currently I have this piece of code.

<select  class="formControl" name="repeatSelect" id="repeatSelect" ng-model="facilitiesData.business_id">
    <option ng-repeat="option in businesses" value="{{option.id}}">{{option.business_name}}</option>
</select>

Thanks.

Answer

MAC picture MAC · Sep 16, 2016

Probably you are looking for this. This could be one of the solution.

This has different type of typeaheads. You can pick one as per your needs.

<input type="text" ng-model="customPopupSelected" placeholder="Custom popup template" uib-typeahead="state as state.name for state in statesWithFlags | filter:{name:$viewValue}" typeahead-popup-template-url="customPopupTemplate.html" class="form-control">

Note - You will require a library ui-bootstrap-tpls which is officially created by AngularJS team.