0

Can anyone please tell me how to create a editable search box, (not autocomplete), since in autocomplete only when we type the selection appears, but in this case when we are not typing anything all the options to be shown like as dropdown, as well as when we type anything options shown should be filtered based on that

Should Works like autocomplete as well as like select.

can anyone please tell me some solution for this

Working Demo

html

<select ng-model="names" ng-options="person.name for person in persons | orderBy:'name'" ng-change="select()">
</select>

script

var app = angular.module('myApp', []);

app.controller('Controller', function ($scope) {
    $scope.persons = [{
        "uid": 1171,
            "name": "Mary",
            "description": "Mary"
    }, {
        "uid": 1172,
            "name": "John",
            "description": "John"
    }, {
        "uid": 1173,
            "name": "Sunny",
            "description": "Sunny"
    }, {
        "uid": 1174,
            "name": "Jacob",
            "description": "Jacob"
    }, {
        "uid": 1175,
            "name": "Susan",
            "description": "Susan"
    }, {
        "uid": 1176,
            "name": "Supriya",
            "description": "Supriya"
    }, {
        "uid": 1177,
            "name": "Sumaya",
            "description": "Sumaya"
    }];
});
1

1 Answer 1

2

Sounds like ui-select.

Demo here - see last select box.

For example:

<ui-select ng-model="country.selected" theme="selectize" ng-disabled="disabled" style="width: 300px;">
  <ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match>
  <ui-select-choices repeat="country in countries | filter: $select.search">
    <span ng-bind-html="country.name | highlight: $select.search"></span>
    <small ng-bind-html="country.code | highlight: $select.search"></small>
  </ui-select-choices>
</ui-select>
Sign up to request clarification or add additional context in comments.

1 Comment

I always say: IE users are already used to the web being broken, so why care? But seriously, if you absolutelly need to support IE8 then I guess you would be left with wrapping some JQuery plugin in your own directive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.