Custom directive event not firing inside matMenuContent
Reproduction
https://stackblitz.com/edit/angular-kywfzy I have written a custom directive which opens a confirmation dialog when click event is fired on its host element. When user confirms action, it emits event to which I subscribe in template. Attaching this directive to elements inside lazily-rendered material menu has no effect.
Expected Behavior
Custom events should fire like they do with "eagerly" rendered menus.
Actual Behavior
Events don't fire
<!-- Simple button with custom event, works fine -->
<button mat-button alert-confirm (confirmEvent)="onDelete()">
<mat-icon color="warn">delete</mat-icon>Delete
</button>
<!-- Default menu, works fine -->
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item alert-confirm (confirmEvent)="onDelete()">
Delete
</button>
</mat-menu>
<!-- Lazily rendered menu, doesn't work -->
<button mat-icon-button [matMenuTriggerFor]="itemActions">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #itemActions="matMenu">
<ng-template matMenuContent>
<button mat-menu-item alert-confirm (confirmEvent)="onDelete()">
Delete
</button>
</ng-template>
</mat-menu>

Environment
- Angular: 8.2
- CDK/Material: 8.2
- Browser(s): Google Chrome 77
This is actually the same root cause as in https://github.com/angular/components/issues/17591.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.