ngDoCheck() called multiple times

hello,

i am trying to add a listener as below. on clicking on the node the listener is getting called multiple times in angular app. what can be the issue.
please let me know

this.myDiagramComponent.diagram.addDiagramListener(“ObjectSingleClicked”,

  function(e) {console.log('this is');

  });

capture count

thanks
amey

I am unable to reproduce the problem in the Minimal sample.

Can you confirm that you execute that call to Diagram.addDiagramListener only once ever?
Check that your corresponding call to Diagram.removeDiagramListener is being called, too.

hello walter,

I have confirmed as per your suggestion. ngDoCheck() getting called multiple times.

below is the code using which I have confirmed. what could have possible gone wrong.

public count:any = 0;
ngDoCheck(){
this.count++;
if(this.myDiagramComponent && this.myDiagramComponent.diagram instanceof go.Diagram){
this.myDiagramComponent.diagram.addDiagramListener(‘ChangedSelection’, (e: go.DiagramEvent) => { console.log('ngDoCheck getting called multiple times ==> '+this.count); });
}
}

below is count captured on single click.
capture count

What!? You should not be making side-effects in ngDoCheck. Please read about what ngDoCheck should do. This problem has nothing to do with GoJS.