【问题标题】:UI select angular with disabled search pops out keyboard on mobile devices禁用搜索的 UI 选择角度在移动设备上弹出键盘
【发布时间】:2016-03-03 06:52:24
【问题描述】:

我在 bootstrap 上使用 select 2 主题作为 angular。

默认情况下,它有一个内置的“搜索”来过滤选项行。 我不想要那一行,所以我在网上搜索解决方案。 常见的解决方案是使用 ng-disabled,它在某些浏览器上运行良好,但在手机上仍然会弹出键盘。

我使用了这个 plunker 上描述的“return false”方法: http://plnkr.co/edit/jE0qBpewzvHG5oamB7vQ?p=preview&s=TIKKc2Zmyq5lcvXI

然而,当我在移动设备上打开它(chrome 上的 lg g2)时,我遇到了两个问题:

  1. 键盘弹出。

  2. 我会打字(奇怪的是我不会打字,但我会打字希伯来语)

pluker 上描述的代码:

<ui-select multiple ng-model="multipleDemo.colors" onkeypress="return false;" theme="select2" ng-disabled="disabled" style="width: 300px;">
<ui-select-match placeholder="Select colors...">
  <span ng-if="!disabled">{{$item}}</span>
  <span ng-if="disabled">
    <a class="glyphicon glyphicon-remove" ng-click="$select.removeChoice($index)" tabindex="-1"></a>
    {{$item}}
  </span>
</ui-select-match>
<ui-select-choices repeat="color in availableColors | filter:$select.search">
  {{color}}
</ui-select-choices>

我不想弹出键盘,也不想让用户打字。

这在原生 android 浏览器上无法重现,只能在 Chrome 上重现。

【问题讨论】:

    标签: angularjs twitter-bootstrap mobile ui-select angular-ui-select


    【解决方案1】:

    最终我结合了几种解决方案 - 最有帮助的是 - html-mobile-forcing-the-soft-keyboard-to-hide

    现在我的选择看起来像这样:

    <ui-select 
     ng-model="multipleDemo.colors" 
     onkeypress="return false;" 
     theme="select2" 
     ng-disabled="disabled"
     onfocus="blur();" >
     .
     .
     </ui-select>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-12
      • 1970-01-01
      • 2012-07-05
      相关资源
      最近更新 更多