AngularJS UI选择禁用下拉列表,并使其仅搜索



这是我问题的plunker:http://plnkr.co/edit/9dslidtzr7rjdeq6pw0h?p = preview

我想仅搜索下拉菜单:仅在用户开始键入时仅查看下拉列表的列表,并且只有包含键入单词或字母的相应项目应显示在列表中,否则列表根本没有显示。

<ui-select ng-model="person.selectedValue" theme="select2" ng-disabled="disabled" style="min-width: 300px;" title="Choose a person">
    <ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.value.name}}</ui-select-match>
    <ui-select-choices repeat="person.value as (key, person) in peopleObj | filter: {'value':$select.search}">
      <div ng-bind-html="person.value.name | highlight: $select.search"></div>
      <small>
        email: {{person.value.email}}
        age: <span ng-bind-html="''+person.value.age | highlight: $select.search"></span>
      </small>
    </ui-select-choices>
  </ui-select>

您可以使用ng-style并修改ul高度属性。不要以为库中有任何OOB解决方案

<ui-select-choices ng-style="($select.search != '')? {'height' : 'auto'}: {'height' : '0px'}" repeat="person.value as (key, person) in peopleObj | filter: {'value':$select.search}">
        <div ng-bind-html="person.value.name | highlight: $select.search"></div>
        <small>
        email: {{person.value.email}}
        age: <span ng-bind-html="''+person.value.age | highlight: $select.search"></span>
      </small>
</ui-select-choices>

让我们知道。

相关内容

  • 没有找到相关文章

最新更新