AngularJS ui-select - 不选择下拉列表中的选项

AngularJS ui-select - not selecting option on dropdown

本文关键字:选项 下拉列表 选择 ui-select AngularJS      更新时间:2023-09-26

我有 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>    

我正在寻找一种关闭过滤的方法,关闭提前键入选项,因此此元素的外观更像常规选择。

此外,当带有值的提要 - 通过模型 - 当单击以展开列表中的选择时,与值不同步 - 它选择列表上的第一个值而不是由模型驱动的值 - 当"点击离开"变为正常时。是它的设置吗?

使用 UI 引导预类型功能。希望它是轻量级和简单的。

<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>

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