I am looking to create a keydown event that will be triggered by alphanumeric or special characters like #$@.
<input type="text" style="width: 70%;" [(ngModel)]= "textMessage" (keydown) ="sendTypingEvent()" >
However, I want to prevent the event from being triggered by keys such as enter, escape (esc), shift, alt, tab, backspace and command (meta), arrows, and function keys (f1 through f12).
Is it possible to set up a REGEX pattern directly in the HTML?
<input (keydown.a)="..."> --expect to trigger
Currently, I can filter out unwanted keys within the event handling function as shown below. But I am exploring other options.
sendTypingEvent(event) {
if (event.key === "Enter" || event.key ==='esc' .... ) {
console.log("skip this event");
}
}