Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.5K
Views
How to handle right click event in Angular app?

In Angular is there a way to catch right click events? I see (click) and (dblclick), but when I try (rightclick) it does not trigger any events. Is there a way to include right click events and have them be handled by a function similar to the click and dblclick if it does not exist?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The event name is contextmenu. So, your html template code can be something like this:

<div (contextmenu)="onRightClick($event)"></div>

$event is an optional parameter so your template and event handler can look like this:

<div (contextmenu)="onRightClick()"></div>

onRightClick() {
    return false;
}

NOTE: You can return false; to avoid default browser action from the event.

over 4 years ago · Santiago Trujillo Report

0

The event name is "contextmenu", so you should use something like this:

<button (contextmenu)="onRightClick($event)"> Right click me </button>

Then the onRightClick function should look something like this:

onRightClick(event) {
 event.preventDefault() //this will disable default action of the context menu
 //there will be your code for the expected right click action
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!