Detect Angular Material Menu DOM Insertion

57 Views Asked by At

I am in search of a method that executes after a Mat Menu has been opened and inserted into the DOM. My goal is to check the height of the menu once it is fully drawn.

I have attempted the following code:

<img src="assets/img/info.svg"
     #menuTrigger="matMenuTrigger"
     [matMenuTriggerFor]="menu"
     (menuOpened)="menuOpened()">
<mat-menu #menu="matMenu">
</mat-menu>

However, the menuOpened event fires before the menu is fully drawn, resulting in an incorrect height measurement.

Any suggestions on how to ensure that my code runs after the menu has been completely drawn?

I'm using Angular 11

0

There are 0 best solutions below