Change link color

I am using the go-js diagram for angular. I used your starter app - gojs-angular-basic-master. I am trying to change the color of the link programatically. Upon initializing the diagram, I added this
// Add an event listener for ObjectSingleClicked
dia.addDiagramListener(“ObjectSingleClicked”, e => {
const part = e.subject.part;
if (part instanceof go.Link) { // Check if the clicked object is a link
// Handle the link click event
console.log(“Link clicked:”,; = ‘red’; // this does not work

How can I change the style of the link?

Two things:
(1) When you want to modify data, use a Model method to do so. In this case:

part.diagram.model.set(, "color", "red");

(2) Depending on a data property means the Link template should have a Binding depending on “color” and setting the Shape.stroke property.