Answers for "Angular detecting escape key press"

0

Angular detecting escape key press

@HostListener('document:keydown.escape', ['$event']) onKeydownHandler(event: KeyboardEvent) {
    console.log(event);
}
Posted by: Guest on October-04-2021
0

Angular detecting escape key press

const ESCAPE_KEYCODE = 27;

@HostListener('document:keydown', ['$event']) onKeydownHandler(event: KeyboardEvent) {
    if (event.keyCode === ESCAPE_KEYCODE) {
        // ...
    }
}
Posted by: Guest on October-04-2021

Code answers related to "Angular detecting escape key press"

Browse Popular Code Answers by Language