add hostlistener angular in main component code example Example: import hostlistener angular import { HostListener } from '@angular/core'