0

我有用于帮助角度形式字段类型的ui-select元素。我确定指标是这样的:AngularJS ui-select - 在下拉菜单中不选择选项

<ui-select ng-model="model[options.key]" theme="bootstrap" ng-required="{{to.required}}" ng-disabled="{{to.disabled}}" reset-search-input="false">, 
    <ui-select-match placeholder="{{to.placeholder}}">, 
     {{$select.selected[to.labelProp || \name\]}}, 
    </ui-select-match>, 
    <ui-select-choices group-by="to.groupBy" repeat="option[to.valueProp || \value\] as option in to.options | filter: $select.search">, 
     <div ng-bind-html="option[to.labelProp || \name\] | highlight: $select.search"></div>, 
    </ui-select-choices>, 
</ui-select>  

我正在寻找一种方式来关闭过滤,提前关闭类型选项,所以这个元素将更像常规选择与它的外观。

此外,当通过模型输入值时 - 单击以扩大列表中的选择与值不同步时 - 它将选择列表中的第一个值,而不是由模型驱动的值 - 当“单击”时恢复正常。它是一个设置吗?

回答

0

使用UI Bootstrap Typeahead功能。希望它轻巧易用。

<div class='container-fluid typeahead-demo' ng-controller="TypeaheadCtrl"> 
    <h4>Static arrays</h4> 
    <pre>Model: {{selected | json}}</pre> 
    <input type="text" ng-model="selected" uib-typeahead="state for state in states | filter:$viewValue | limitTo:8" class="form-control"> 
</div> 

在你的控制器中,有一个状态数组。

+0

感谢您的回复 - 我正在寻找相反的东西 - 关闭类型 – bensiu