0

I am using form in angular. When I click enter in any input field. It opens bsmodal.

3 Answers3

1

You can stop the enter keydown directly in the form like this:

<form (keydown.enter)="$event.preventDefault()"></form>
Michael Desigaud
  • 2,115
  • 1
  • 15
  • 15
1

You might be able to fix this with a type="button" on your button that opens your modal if it's inside a form element.

For reference:

Matthew Beck
  • 451
  • 5
  • 19
0

you are using html form or some angular component to create form? You just have to stop the event You can use following code if you can use jq in your application

$('form input').keydown(function (e) {
    if (e.keyCode == 13) {
        e.preventDefault();
        return false;
    }
});
Parshant Dutta
  • 450
  • 1
  • 4
  • 12