Search code examples
htmlangularjsng-optionssearch-box

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>

Solution

  • 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="o in $ctrl.options"><input type="search"/></li>
    <ul>
    

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