I am using a directive to get the data from input used as a filter text.
here is my hostlistener in the directive:
@HostListener(\'input\', [\'$event
If you wish to use a key code (or "which"), you can do this:
// @HostListener('document:keypress') const escapeEvent: any = document.createEvent('CustomEvent'); escapeEvent.which = 27; escapeEvent.initEvent('keypress', true, true); document.dispatchEvent(escapeEvent);