Angular event call services


#1

Hi I am using mindmap and I am trying yo run a services but I can not find the way:

loadData() {
this.diagram = new dhx.Diagram(this.containerDiagram.nativeElement, {
select: true,
type: “mindmap”,
typeConfig: {
direction: “right”,
},
});

this.nodeSrv.getNodeJsonByProjectId(this.project_id).subscribe((nodes) => {
  this.data = nodes;
  nodes.forEach((element) => {
    if (element.parent == "0") {
      delete element.parent;
    }
  });
this.diagram.data.parse(this.data)

  this.diagram.events.on("shapeClick", function (id) {
    this.eventEmitterService.onNodeEditComponentClick(); // this event is never fired I tried adding the listener by my selft but did not work, I can not see the context of the componenet inside this function

    alert('An item "' + this.data.getItem(id).text + '" is clicked');
  }); 
  this.isLoading = false;
});

}


#2

Unfortunaetly I was not abler to reporoduce your issue locally.
shapeClick event woirks well for me locally.
If the problem still occurs for you please, make sure that you are using the latest dhx.Diagram build, or provide a complete demo where the problem can be reconstructed locally.