我有一个项目大小较大的下拉菜单,所以我正在寻找一种方法来启用键盘输入(按键),以便我可以键入并自动移动到该选项下降。有什么建议吗?
试过这个,但没有表现出任何差异:
<div class="btn-group" uib-dropdown dropdown-append-to-body ng-keyup="onKeyUp($event)">
<button id="btn-append-to-body" type="button" class="btn btn-primary" uib-dropdown-toggle>
Dropdown on Body <span class="caret"></span>
</button>
<ul uib-dropdown-menu role="menu" style="max-height: 150px; overflow-y: auto; max-width : 10px" >
<li ng-repeat="value in feature.values | filter: tappedKeys | unknownValueFilter | featureValueOrder ">
<a ng-click="currentValue.set(value)" href="">
{{value | featureValueFormatter }}
</a>
</li>
</ul>
</div>
在控制器中:
$scope.tappedKeys = '';
$scope.onKeyUp = (e)=>{
$scope.tappedKeys += e.key;
};
但问题是,一旦我选择了值,当下拉值变为正常时,按键值也不会清除 示例:https://plnkr.co/edit/vZCv3RI095snv9ITAXr8?p=preview