0
votes

I am using both click and long press event on the same element. Long press triggers the mat menu that is working fine and it should not work on click.How to stop triggers the mat-menu on click event.

It should trigger by program only.

<div *ngFor="let table of tableDetails; let i = index"

          style="padding-bottom: 10px;"
          (click)="doCheckAction(table, false)"  (touchstart)='openContextMenu(true,menuTrigger,table)' (touchend)='openContextMenu(false,menuTrigger,table)'  
            >

ts:

  openContextMenu(isDown, menu, table) {
    if (table.Status !== "Available") {
      if (isDown) {
        this.pressTimer = window.setTimeout(() => {
          menu.openMenu();
        }, 1000);
      } else {
        clearTimeout(this.pressTimer);
      }
    }

  }
1

1 Answers

0
votes

Put preventDefault() before doCheckAction():

<div ...(click)="$event.preventDefault();doCheckAction(table, false)" ...>