Angular ContextMenu - Access the Clicked Item

To access the clicked item, handle the itemClick event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the onItemClick property when you configure the UI component.

HTML
TypeScript
  • <dx-context-menu ...
  • (onItemClick)="itemClick($event)">
  • </dx-context-menu>
  • import { DxContextMenuModule } from 'devextreme-angular';
  • // ...
  • export class AppComponent {
  • // ...
  • itemClick(e) {
  • const { itemData, itemElement, itemIndex } = e;
  • // ...
  • }
  • }
  • @NgModule({
  • imports: [
  • // ...
  • DxContextMenuModule
  • ],
  • // ...
  • })
See Also