What I want to achieve is for a given component instance I want to iterate over all the EventEmitter
decorated with @Output
.
For e.g.
my-component
@Component({
moduleId: module.id,
selector: "my-component",
template: "<h1>My Component!!"
})
export class MyComponent{
@Output() emitter1: EventEmitter<any> = new EventEmitter<any>();
@Output() emitter2: EventEmitter<any> = new EventEmitter<any>();
}
so lets say I am loading this component dynamically like below,
this._cr.resolveComponent(MyComponent).then(cmpFactory => {
this.testComponentContainer.clear();
let instance: any = this.testComponentContainer.createComponent(cmpFactory).instance;
// Here I want to iterate over EventEmitter dynamically
// So that I may bind to both emitter1 and emitter2
});
Can i do this? Thanks in advance!!