0

enter image description here

Hello, I have several matMenu for example #status="matMenu", #something = "matMenu", i want to close active matMenu on child component's Approve button click. child component is in matMenu. but every time when I use
`

  @ViewChild(MatMenuTrigger, { static: false }) matMenuTrigger: MatMenuTrigger;

  this.matMenuTrigger.closeMenu();`

it closes only first matMenu. can anyone help me?

John Doe
  • 80
  • 1
  • 11
  • 3
    In that case I'd recommend using Angular's `@ViewChildren` instead which returns a list of the specified elements (see https://angular.io/api/core/ViewChildren). You can then iterate over them and check each element's `menuOpen` property and close it accordingly (see https://material.angular.io/components/menu/api). – Aldin Bradaric Nov 19 '21 at 07:46

0 Answers0