Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Created August 28, 2021 07:47
Show Gist options
  • Save Mayankgupta688/66fc4f356611cc940bea9c65b9b15048 to your computer and use it in GitHub Desktop.
Save Mayankgupta688/66fc4f356611cc940bea9c65b9b15048 to your computer and use it in GitHub Desktop.
import { Component, HostListener } from "@angular/core";
@Component({
selector: "app-root",
template: `
<div>
<h1>This is Application Header</h1>
<h2>This is Other Header Component</h2>
</div>
`,
styleUrls: ["./app.component.css"]
})
export class AppComponent {
title = "host-listener";
color: string = "red";
@HostListener("click", ["$event"])
onScroll(event) {
console.log("User Clicked on Window..." + event.target.tagName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment