Ng-bootsrap: typeahead close popover after selecting item from dropdown

Viewed 378

I am using ng-bootsrap 4 and Angular 7. When I use typeahead component inside popover component and after I select item from typeahead dropdown, popover automatically closed. I setup autoClose="outside" for popover. How to make that popover will not be closed after selecting item in typeahead list?

2 Answers

Setting autoClose won't work in this case. If you check the popover source, you will find the logic to dismiss the popover is to check if popover window element contains event target which is the selector from typeahead. Referring to ng-bootstrap online doc, it states that container: A selector specifying the element the tooltip should be appended to. Currently only supports "body".. Since body is not an element inside popover window element, it will treat it as outside click.

You can try to add event.stopPropagation() on click on the typeahead component

Related