Pseudo-events

This is the documentation for Angular 6.
You can switch to the latest version Angular 7.

You can filter keyboard events in a template by event key.

Angular allows you to directly bind to a specific keystroke or keystroke combination. That means a keyboard event will be only fired on that specific key or key combination instead of on all key events.

Source
<input (keyup.enter)="enterHandler()">
<input (keydown.esc)="escHandler()">
<input (keyup.shift.f)="shiftFHandler()">
export class AppComponent {
  enterHandler() {
    alert('Enter pressed!');
  }

  escHandler() {
    alert('ESC pressed!');
  }

  shiftFHandler() {
    alert('Shift+F pressed!');
  }
}
Result
Tutorials