How to dynamically create @Output on an Angular Component?

275 views Asked by At

For the sake of simplicity, Let's say we have a MyComponent with an @Input() eventName = 'signal'.

I would like to use the value signal as the name of a dynamically created EventEmitter. Which I can use as a regular @Output as so:

<my-component [eventName]="'signal'" (signal)="onSignal()"></my-component>

My actual use case needs an array of "event" objects which would contain some other info for the template apart from the unique name to be used as the @Output name.

0

There are 0 answers