Close matMenu on Dialog Open?

Discussão em 'Angular' iniciado por Divyanshu Rawat, Dezembro 13, 2024.

  1. I am triggering a dialog on clicking an item in matMenu but the concern is that matMenu doesn't close when dialog is open. I want it to close it as soon as dialog box opens up, it closes when you click somewhere in the page, but I want it to close once dialog box opens.

    this is the code-snippet for matMenu.

    <button mat-icon-button [matMenuTriggerFor]="menu" #menuTrigger="matMenuTrigger" (mouseup)="menuTrigger.closeMenu()">
    <mat-icon>more_vert</mat-icon>
    </button>
    <mat-menu #menu="matMenu" xPosition="before" >
    <button mat-menu-item (click)="openUpdateQuestionDialog($event,currentSelectedQuestion)">
    Edit
    </button>
    <button mat-menu-item (click)="confirmDeleteQuestion($event,currentSelectedQuestion)">
    Delete
    </button>
    </mat-menu>


    I am trying different ways to make it work, but no luck.

    Continue reading...

Compartilhe esta Página