Skip to content

Instantly share code, notes, and snippets.

@semagarcia
Created April 14, 2021 19:32
Show Gist options
  • Save semagarcia/df4cef7c9349ba3f97cdcfc7443cd035 to your computer and use it in GitHub Desktop.
Save semagarcia/df4cef7c9349ba3f97cdcfc7443cd035 to your computer and use it in GitHub Desktop.
Option A: "standard way" => Class (in Angular example, use this snippet inside AfterViewInit lifecycle hook):
// OPTION A: "standard way" => Class
// In Angular example, use this snippet inside AfterViewInit lifecycle hook:
class MyAngularComponent implements AfterViewInit {
ngAfterViewInit() {
// Standard-way
document.querySelector('#clickCounter')
.addEventListener('counter-clicked', this.myCallbackFunction);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment