Tho*_*mas 6 javascript twitter-bootstrap angular-ui-bootstrap angular-ui-typeahead
尝试在没有结果的情况下得到一个下拉菜单,但下拉菜单不显示视图
<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>
Run Code Online (Sandbox Code Playgroud)
删除class ="dropdown-menu"给了我没有结果的li,但是我不把它作为下拉菜单
谁没有结果我切换这个下拉菜单?
问题是下拉永远不会被触发,并且由于没有正确呈现.你只是让标记可见.
您可以设置auto-close="disabled"
并is-open="true"
正确显示下拉列表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>
Run Code Online (Sandbox Code Playgroud)
工作演示 - > http://plnkr.co/edit/4vVznXyjZo3HuIb2p5as?p=preview
注意:plnkr使用的是ui-bootstrap版本0.14.3,如果您使用的是0.14.0之前的版本,则不要附加uib-
前缀.
归档时间: |
|
查看次数: |
15128 次 |
最近记录: |