How to detect right-click in Angular

How to detect right-click in Angular

To detect a right-click, use (contextmenu).

<div contextmenu='onContext()'></div>

The onContext handler is executed when you right-click inside the div tag.

Since the context menu is displayed at the end of the right-click, return false; should be written at the end.

onContext() {
  // some kind of code
  return false; // I'll write this down.
}

コメント

Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL