如何删除重点从UI的选择选择一个选项之后 [英] How to remove focus from ui-select after selecting an option

查看:229
本文介绍了如何删除重点从UI的选择选择一个选项之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一旦用户用鼠标点击选择一个选项,从UI的选择输入移除焦点和进入开始搜索。现在发生的事情是,焦点仍在那里选择和结果的下拉列表中打开了进入点击

I need to remove focus from ui-select input once the user has selected an option using mouse click and on enter start searching. Now what happens is that the focus is still there on select and as a result the dropdown list is opened on clicking 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>

推荐答案

添加上选择=onSelected($项目)到你的UI选择和控制器:

Add on-select="onSelected($item)" to your ui-select and in controller:

$scope.onSelected = function (selectedItem) {
    setTimeout(function(){
        $(':focus').blur();
    })
}

或控制器使用$超时

这篇关于如何删除重点从UI的选择选择一个选项之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆