0

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.

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
  • Not sure what you mean with "is not under my control", but why does not the simple [(letdown.enter)="myMethod()"](https://stackoverflow.com/a/37939193/6336460) syntax not work for you? – Lucho Mar 26 '21 at 21:55
  • @Lucho it means that is part of the component from the library – Francesco Borzi Mar 27 '21 at 16:46

0 Answers0