We have created a sample for the diagram with a context menu. We have checked the diagram context menu feature in Angular 12 and it working fine. Also we can able to interact with the context menu. We suspect that the issue occurs because you do not inject the DiagramContextMenu module in the diagram or you do not add the context menu-related CSS in the style.css, So that the context menu does not gets appeared while right in the diagram.
To use the context menu in the diagram, please inject the DiagramContextMenu module in the diagram and add the context menu-related CSS in the style.css file
Please refer to the code snippet for how to inject DiagramContextMenu and how to use the context menu CSS.
//app.component.ts
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Diagram, NodeModel, ConnectorModel, SnapConstraints, SnapSettingsModel, DiagramTools, ContextMenuSettingsModel, DiagramContextMenu } from '@syncfusion/ej2-diagrams';
import { DataManager } from '@syncfusion/ej2-data';
Diagram.Inject(DiagramContextMenu)
public contextMenu: ContextMenuSettingsModel = { show: true}
;
// Style.css
@import '../node_modules/@syncfusion/ej2-angular-diagrams/styles/material.css';// Add the context menu related css
@import ../node_modules/@syncfusion/ej2-navigations/styles/material.css;
We have attached a video demonstration of how the diagram context menu gets worked. Please refer to the below video link.
Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ContextMenu-Video1968682518
We have attached an Angular-12 sample with a context menu for your reference. Please find the sample in the below link
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Angular-ContextMenu1248041383
In case if the issue is still replicated, please share with us a simple sample illustrating the issue or modify the above sample replicating the issue with issue replication steps. This would help us to serve you better.