Hi everyone! I have a question.
I created small demo project in Angular 2+ and I found one feature: if I delete Node from Diagramm - its automaticly deleting this object from Model and I don’t need to think about deleting this object.
When I delete link - it’s not deleting from model automatictly and I have to change model manualy. My way to do this:
I don’t understand how to bind Links to Model as Nodes Binded. I didnt find place where to do this.
Please, assist me to understand deeper how it works.
How is your diagramModelChange function defined? If you look at the gojs-angular-basic sample, you can see how that function in that sample syncs up the app data from the data in the GoJS model.
when I delete Node in event I recieve
{ removedLinkKeys:[
“d2e45060-d763-4f21-a8ed-66eeac4f724a”
“0f9aac10-9b8c-4dff-930a-8fad59e6deab”
“3eb876d2-08c0-412a-8ef1-236af12a1583”],
removedNodeKeys: [0] }
if I delete Link - I recive null, its reason why diagramLinkData isnt syncing;
So, why do I have null when deleting Link in diagramModelChange function?
@ryanj@walter
Hi, guys. Thanks for help.
I found what was wrong.
My Link has userData - > object with fileds.
After I changed this userData I used this:
this.selectedNode.data = _.cloneDeep(this.selectedNode.data) to trigg changes in model;
But after I deleted Link - It was deleting in diagram, but not in model;
What I use now :
Object.keys(result).map(key => {
this.diagram.model.setDataProperty(this.selectedNode.data, key, result[key]);
});