【发布时间】:2015-04-14 11:27:12
【问题描述】:
我希望在表单提交的值不在列表中时关闭选择列表(使用 typeahead-focus-first)。我以typeahead plunker 示例为起点。
当用户按下回车键时,storeItem 函数会触发,但列表不会关闭。
<form ng-submit="storeItem()">
<input type="text"
typeahead="state for state in states | filter:$viewValue | limitTo:8"
typeahead-focus-first="false"/>
</form>
提交函数:
$scope.storeItem = function() {
$scope.selected = Date.now();
};
查看完整的 plunker here
如何关闭列表,同时保持输入值和列表不变?
【问题讨论】:
-
您是否在angular-ui.github.io/bootstrap/#/typeahead 中的确切 plunkr 链接之后看到此问题?你在演示页面中有它吗?你能准确描述你的步骤来达到这个效果吗?
标签: javascript angularjs angular-ui-bootstrap angular-ui-typeahead