Angular – @HostListener

Introduction

@HostListener decorator tells Angular that when an event on your host happens, you want the decorated method to be called with the event.

Example Code

Output

Let me know if you have some comments or questions. Till next time, Happy Coding.