ng-bootstrap NgbTypeahead How to react on select?

2019-09-18 14:38发布

问题:

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?

回答1:

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