I am working with input
s but I am not really sure about how is the configuration of the navigation done (I guess that it are predefined behaviours).
I am not in the last input
the enter key goes to the next one. This one is working as I want.
Nevertheless, when I am on the last input
, when I press enter, it automatically clicks on the next button
.
This is what I am trying to avoid. Is there any way to change this behaviour? Just to close the keyboard or to click on another button
?
I have tried with keyup.enter
and it pseudo works. It calls to the method but also clicks on the next button
HTML
<input
type="text"
class="form-control"
id="validationCustomSurname"
placeholder="e.g. Lopez"
required
(keyup.enter)="onNavigate(1, 'forward')"
[(ngModel)]="values.store.surname"
name="surname"
/>
This method should work on a phone, so I guess that keydown
is not an option since $event.code
does not give me any code in the phone.
Some time ago I make a directive see stackblitz that you apply in a div (or in a form) in the way
The directive use ContentChildren to add a keydown.enter to all the components that have #nextTab to focus to the next control