Angular 10: Event Binding Issues

Good Morning,

I am trying to use the “ObjectDoubleClicked” Diagram Event to trigger a Typescript function. That Typescript function would receive the Object information for the node being pressed and open an Angular Dialog to display more information about the node in question.

My first thought was to place the event binding inside of the diagram definition like so:

dia.addDiagramListener("ObjectDoubleClicked",
            function (e) { this.DialogFunction(e) });

However, this didnt work as this. references do not work inside of the diagram instantiation.

What would be a better approach to accomplishing this?

Don’t use function unless you are overriding a method.

dia.addDiagramListener("ObjectDoubleClicked", e => this.DialogFunction(e));

This advice is quite general and doesn’t really apply only to GoJS.

Looks like that was the problem I was having.

Thanks!