I have Angular component with event defined like this:
// selector: 'my-component'
export class MyComponent {
@Output() customEvent = EventEmitter();
}
Later in structural directive I access native Html element of this Angular component:
const view = this.viewContainer.createEmbeddedView(this.templateRef);
const rootElem = view.rootNodes[0];
const myNativeComponent = rootElem.querySelector('my-component');
Now, is there any way to listen on 'customEvent' having only myNativeComponent instance?
// this doesn't work:
myNativeComponent.addEventListener('customEvent', ...)