How to update link strokeDashArray by link text

I want to set different line styles according to different line texts.
Below is my code

myDiagram.linkTemplate = $$(go.Link, {
                //curve: go.Link.Bezier,
                toShortLength: 8,
                toEndSegmentLength: 20
            },
            $$(go.Shape, {strokeWidth: 2, stroke: "grey", strokeDashArray: []}),
            $$(go.Shape, {toArrow: "Triangle", fill: "grey", stroke: null}),
            $$(go.TextBlock, "", {
                textAlign: "center",
                stroke: "#2F4F4F"
            }, new go.Binding("text", "text", function (text, link) {
                if(text === 'something'){
                   **//update  link strokeDashArray here**
                    console.log(link);
                }
            }))
        );

You really should not be having any side-effects in your Binding conversion function. (Well, console.log is OK, of course, but not anything that would modify the model or the diagram. You cannot depend on when or how often the binding will be evaluated.)

Why not put a Binding on the Shape whose Shape.strokeDashArray you want to set based on the value of the data.text property?

1 Like