I have created a component with an event, lets call it (onAction). Within the same parent component or page, it is used in two places (which are components themselves). The difference is one place is used within an ng-template, which is used in a modal (NgbModal from the angular - bootstrap4 library to be exact).
The one not within the ng-template works fine. However, when the event inside the ng-template is fired, it is as if it is not bound with onActionB and the event is caught by the other component.
Here is some generic code to be clear, lets call it component "comp" for simplicity sake and the two of parent components that uses it "parentA" and "parentB"
<parentA>
...
<comp (onAction)="onActionA($event)"></comp>
...
</parentA>
<parentB>
...
<ng-template #someModal>
<comp (onAction)="onActionB($event)"></comp>
</ng-template>
...
</parentB>
When #someModal is rendered, it is as if the (onAction) is bind with onActionA in parentA. It triggers onActionA($event) instead of onActionB($event). The strange thing is if I comment out the comp in parentA, then onActionB in parentB is triggered.