I want to make mat-menu to open and close dropdown menu without button click.
I can fined the following sample code
https://stackblitz.com/edit/mat-nested-menu-yclrmd?embed=1&file=app/nested-menu-example.html
, but when I tried to use it from angular 17 (angular-material 17), I see the following exception
ERROR TypeError: Cannot read properties of undefined (reading '_elementRef')
from
this.ren.removeClass(
trigger.menu.items.first['_elementRef'].nativeElement,
'cdk-focused'
);
I'm new to Angular, and can someone know what can be the cause of this issue?
Thank you!