一旦用户使用鼠标单击并进入输入开始搜索选择了一个选项,就需要从ui选择输入中删除焦点。现在发生的事情是焦点仍然集中在select上,因此单击Enter即可打开下拉列表。
<ui-select id= "country" ng-model="ctry" name= "country" theme="bootstrap">
<ui-select-match >{{text || $select.selected.id}}</ui-select-match>
<ui-select-choices repeat="countryL in countryLookup | filter: $select.search">
<div ng-bind-html="countryL.id | highlight: $select.search"></div>
<small ng-bind-html="countryL.name | highlight: $select.search"></small>
</ui-select-choices>
将on-select =“ onSelected($ item)”添加到ui-select中并在控制器中:
$scope.onSelected = function (selectedItem) {
setTimeout(function(){
$(':focus').blur();
})
}
或在控制器中使用$ timeout
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句