Angular UI bootstrap - 在typeahead-no-results上显示下拉列表 [英] Angular UI bootstrap - show dropdown on typeahead-no-results

查看:112
本文介绍了Angular UI bootstrap - 在typeahead-no-results上显示下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在没有结果的情况下获得下拉菜单,但下拉菜单不显示
查看

tryng to get a dropdown when no result on typeahead but, the drop down menu dosen't show view

<div class="dropdown">
    <div class="form-group">
       <input placeholder="Vælg kunde" type="text" ng-model="customer"  typeahead-editable="false" uib-typeahead="customer as customer.customer for customer in customers | filter:$viewValue | limitTo:8" class="form-control"
            typeahead-popup-template-url="customPopupTemplate.html"
            typeahead-min-length="0"
            typeahead-no-results="noResults">
    </div>

    <div ng-if="noResults" dropdown-toggle>
       <ul class="dropdown-menu" >
           <li><a href="#">No result</a></li>
       </ul>
    </div>

</div>

删除class =dropdown-menu给了我没有结果的li,但是我没有得到它作为下拉菜单

removing class="dropdown-menu" gives me the li with no result, but i dont get it as a dropdown menu

我是否在没有结果的情况下切换此下拉菜单?

who do i toggle this dropdown menu on no result ?

推荐答案

问题是永远不会触发下拉列表,也不会正确呈现下拉列表。你只是让标记可见。

The problem is that the dropdown never is triggered, and by that not rendered properly. You are just making the markup visible.

您可以设置 auto-close =disabled is-open = true noResults 上正确显示下拉列表:

You can set auto-close="disabled" and is-open="true" to show the dropdown properly upon noResults :

<div class="form-group"> 
  <input placeholder="Vælg kunde" type="text" ng-model="customer" typeahead-editable="false" uib-typeahead="state for state in states | filter:$viewValue | limitTo:8" class="form-control" typeahead-min-length="0" typeahead-no-results="noResults">

   <span ng-if="noResults" auto-close="disabled" is-open="true" uib-dropdown uib-dropdown-toggle>
      <ul class="uib-dropdown-menu" >
        <li><a href>no results</a></li>
      </ul>
    </span>

</div>

工作演示 - > http://plnkr.co/edit/4vVznXyjZo3HuIb2p5as?p=preview

working demo -> http://plnkr.co/edit/4vVznXyjZo3HuIb2p5as?p=preview

NB :plnkr使用的是ui-bootstrap版本0.14.3,如果您使用的是0.14.0之前的版本,则不要附加 uib - 前缀。

NB: The plnkr is using ui-bootstrap version 0.14.3, if you are using a version prior to 0.14.0 then do not append uib- prefixes.

这篇关于Angular UI bootstrap - 在typeahead-no-results上显示下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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