Setting selectionChanged of a link template

I want to define a linkTemplate like that

 this.diagram.linkTemplate = _$(go.Link,....

and then do

this.diagram.linkTemplate.selectionChanged = function(part)

It does not seems to work. I know that if i put the selection handler directly in the link template, it works, but i would like to keep these 2 stuff separated. Is there a way to do it ?

That should work. For example, I took a sample and added this statement:

    myDiagram.linkTemplate.selectionChanged = function(link) { console.log(link.isSelected + ": " + + " " +; };

And it performed as I expected.

Could you tell me how to reproduce the problem?

Is the selectionChanged event handler still there when the user is interacting with your diagram?

Here is my code :

            diagram.linkTemplate = _$(go.Link,

            _$(go.Shape, new go.Binding("stroke", "color")),
            _$(go.Panel, "Auto",  // this whole Panel is a link label
                                  //{ visible: hasText },
                _$(go.Shape, "RoundedRectangle", { fill: "#F7F9F7", stroke: "#DFE2EB" }),
                _$(go.TextBlock, { margin: 10,
                        stroke: '#818796',
                        textAlign: 'center',
                        text: '12px regular bold',
                        overflow: go.TextBlock.OverflowEllipsis
                    new go.Binding("text", "text"))
                , { toArrow: "Standard" }
                , new go.Binding("fill", "color")
                , new go.Binding("stroke", "color")

        diagram.linkTemplate.selectionChanged = function(part) {

But it does not work :( . I think it should work. There is no error in console, i will give a try with the debug lib.