ng-bootstrap NgbTypeahead如何响应选择? [英] ng-bootstrap NgbTypeahead How to react on select?

查看:113
本文介绍了ng-bootstrap NgbTypeahead如何响应选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用typeahead控件,用户可以从列表中选择一项(文档 plnkr ).

我如何对选择做出反应?我设法通过在输入中添加(keyup.enter)事件然后在组件上调用另一个方法来对enter做出反应,但是似乎无法在typeahead-popup中的鼠标选择上触发该事件.

我该如何实现?

解决方案

有一个selectItem输出(事件),当用户执行项目选择时将触发该输出(无论选择方法如何). selectItem输出是正式的预录文档的一部分

Using the typeahead control allows a user to select a term from a list (Documentation, plnkr).

How can I react on a selection? I managed to react on enter by adding a (keyup.enter) event to the input then call another method on my component, but I cannot seem to get an event that fires on mouse-selection in the typeahead-popup.

How can I achieve that?

解决方案

There is the selectItem output (event) that is fired when a user does item selection (regardless of the selection method). The selectItem output is part of the official typeahead documentation

这篇关于ng-bootstrap NgbTypeahead如何响应选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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