How to bind the enter key in an ngx-bootstrap modal?

302 Views Asked by At

I'd like to use the ngx-bootstrap modal to build a simple confirmation modal.

The modal asks the user something like "Are you sure?" with "Yes" and "No" as options. It works very well so far.

This is my component:

https://github.com/azerothcore/Keira3/tree/master/src/app/shared/modules/modal-confirm

you can also press ESC to say "no", however I don't see how I can make "Enter" automatically react as a "Yes". How can I achieve it?

In other words, how can I bind the (keydown.enter) to a certain action?

I've noticed that the element that is focused when the modal is opened is not under my control. That's my main issue.

0

There are 0 best solutions below