I can save the GraphLinksModel of my diagram to json as shown below
public save() {
this.savedModel = this.observedDiagram.model.toJson();
}
public load() {
this.observedDiagram.model = go.Model.fromJson(this.savedModel);
}
the Json is bound to a texbox in which I can modify it. For instance I may want to change the color of a shape from yellow to red.
Then I’d call the load() function, but the diagram is not updated. I see that diagramModelChange is called (the event bound to modelChange event of the diagram)
<gojs-diagram #myDiagram [initDiagram]='initDiagram' [nodeDataArray]='diagramNodeData'
[linkDataArray]='diagramLinkData' [divClassName]='diagramDivClassName'
[modelData]='diagramModelData' [skipsDiagramUpdate]='skipsDiagramUpdate'
(modelChange)='diagramModelChange($event)'>
</gojs-diagram>
public diagramModelChange = function (changes: go.IncrementalData) {
this.skipsDiagramUpdate = true;
this.hasChanged = changes !== null;
this.diagramNodeData = DataSyncService.syncNodeData(changes, this.diagramNodeData);
this.diagramLinkData = DataSyncService.syncLinkData(changes, this.diagramLinkData);
this.diagramModelData = DataSyncService.syncModelData(changes, this.diagramModelData);
};
Are they any extra steps to take when using the angular wrapper ? I should be able to update the diagram when reloading the modified json, right ?