Sasika Miyuran Sasika Miyuran -4 years ago 119
AngularJS Question

How to add search box inside <select> tag with ng-option

I need to add search box inside the select tag with ng-option.

<select class="form-control" ng-model="modelname" ng-options="category.id as category.name for category in Categories ng-change="getSubCategory()">
<option><--search box should be here--></option>
</select>

Answer Source

You can't with standard html. You'll have to create something custom - something along these lines.

<ul class="custom-select">
    <li class="custom-select__option" ng-repeat="$ctrl.options"><input type="search"/></li>
<ul>

It won't be hard to create, but that's the direction you'll need to go.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download