Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS下拉菜单中的引导输入字段_Angularjs_Twitter Bootstrap - Fatal编程技术网

AngularJS下拉菜单中的引导输入字段

AngularJS下拉菜单中的引导输入字段,angularjs,twitter-bootstrap,Angularjs,Twitter Bootstrap,我有一个使用引导的下拉菜单,里面有一个输入字段。每次单击输入字段时,下拉菜单就会消失。我该怎么阻止呢 顺便说一下,我使用的是AngularJS,所以jQuery方式可能不适合这里 {{trans('text.choose_user')} 您应该尝试使用angular ui select。这里是链接到 链接到plunker 浏览文档,可以选择几个选项来配置ui选择 配置ui选择的示例代码 <ui-select ng-model="person.selected" theme="b

我有一个使用引导的下拉菜单,里面有一个输入字段。每次单击输入字段时,下拉菜单就会消失。我该怎么阻止呢

顺便说一下,我使用的是AngularJS,所以jQuery方式可能不适合这里


{{trans('text.choose_user')}

您应该尝试使用angular ui select。这里是链接到

链接到plunker

浏览文档,可以选择几个选项来配置ui选择

配置ui选择的示例代码

<ui-select ng-model="person.selected" theme="bootstrap" style="min-width: 300px;">
  <ui-select-match placeholder="Select a person...">{{$select.selected.name}}</ui-select-match>
  <ui-select-choices repeat="person in people | propsFilter: {name: $select.search}">
    <div ng-bind-html="person.name | highlight: $select.search"></div>
  </ui-select-choices>
</ui-select>

{{$select.selected.name}

多亏了@Rob J,我想出了一个解决方案,但与他提到的不完全一样:

<input type="search" class="form-control" placeholder="{{ trans('text.search') }}" ng-click="$event.stopPropagation()">


尝试将ng click=“$event.preventDefault()”添加到输入元素中。将其标记为答案-它可以工作,并且可能对其他人(如我:)有帮助。在ui引导中,它也像一个符咒一样工作。谢谢