Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make disable right click function in angular called from any component

Tags:

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

I want to disable right click in a few components and not the whole website. I have to define the below function in all the components where I want to disable right click. What's the best way to do it so that I don't have to define the function again and again in those components

onRightClick() {
  return false;
}