1import { AfterViewInit, Component, ElementRef} from '@angular/core';
2
3constructor(private elementRef:ElementRef) {}
4
5ngAfterViewInit() {
6 this.elementRef.nativeElement.querySelector('my-element')
7 .addEventListener('click', this.onClick.bind(this));
8}
9
10onClick(event) {
11 console.log(event);
12}
13