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