You need to get hold of MatMenuTrigger
instance from [matMenuTriggerFor]
element
#menuTrigger="matMenuTrigger" [matMenuTriggerFor]="menu"
where
-
#menuTrigger
is the template reference variable -
matMenuTrigger
isexportAs
property ofMatMenuTrigger
metadata
and then simply call
(click)="menuTrigger.openMenu()"
Stackblitz example
Read more about template reference variable here
- What is #auto attribute here and why it is required