I have an Angular component (ParentComponent) that accepts and displays a custom NgTemplate. I want ParentComponent to receive events from a component in the NgTemplate through an EventEmitter. Something like this:
ParentComponent.html
<!-- I want onCustomEvent to be called -->
<ng-container *ngTemplateOutlet="childTemplate" (customEvent)='onCustomEvent($event)'>
</ng-container>
OtherComponent.html
<ng-template #child>
<button (click)='customEvent.emit("Hello World")'>Emit</button>
</ng-template>
<parent-component [childTemplate]='child'></parent-component>
This is about as simple an example I could think of, so hopefully it is enough to get the point across. Is something like this possible? If not, what strategies can be used to accomplish the same thing?