In my Angular project I use an angular data-table and created a context menu. But when clicking on it the default right click option also appears with the created context menu. How can I prevent a default right click action in Angular?
Use event.preventDefault() :
HTML
<div (contextmenu)="foo($event)">
[...]
</div>
TypeScript
foo($event: MouseEvent) {
$event.preventDefault();
/* INSERT CODE HERE */
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With