Last active
July 18, 2018 23:09
-
-
Save JiaLiPassion/60607c006f46427c8e3664841fbae2b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connectedCallback(): void { | |
// subscribe to event emitters of Angular Component and dispatch Custom | |
// Events | |
const eventEmitters = this.componentFactory.outputs.map(propName => this.componentRef.instance as any)[propName]); | |
this.outputEvents = merge(...eventEmitters); | |
this.ngElementEventsSubscription = this.outputEvents.subscribe(e => { | |
const customEvent = document.createEvent('CustomEvent'); | |
customEvent.initCustomEvent(e.name, false, false, e.value); | |
element.dispatchEvent(customEvent); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment