import hostlistener angular 1

import hostlistener angular

import { HostListener } from '@angular/core'

Here is what the above code is Doing:
1. We’re importing the HostListener decorator from the @angular/core package.
2. We’re using the HostListener decorator to listen for the window:resize event.
3. We’re using the @HostListener decorator to call the onResize() method when the window:resize event occurs.
4. We’re using the @HostListener decorator to pass the event object to the onResize() method.
5. We’re using the @HostListener decorator to specify that the onResize() method should run in the browser’s event loop.

Similar Posts