How to check if the attribute binding to exists or is undefined

How to check if the attribute binding to exists or is undefined

in line 284 i wan to check if the “card” even exists in the json array of the link

further more i want to know that how can i get it in the json on link creation
the json i get from drag drop link is just {from : “” , to : “” }
how can get my own attribute in there on its creation with some default value

Bindings are not evaluated if the source data property value is undefined.

But you could set the target property to the value that you want it to take if the source property is undefined. That’s basically the default value, which will be overwritten by the Binding if the source property is not undefined.

So in regards to my second question that how to set extra attributes of a link when it is created will it be done in the link model template or i have to set it after wards in link-drawn event and if possible can you refer me an example i would be grateful.

If the extra properties you want on the link data object are meant to be same for all new links, just set LinkingTool | GoJS API to a JavaScript Object that has the properties you want with the values that you want.

If the extra property values you want depend on the context in which the link was drawn or on other per-link characteristics, then you’ll need to set those properties in a “LinkDrawn” DiagramEvent listener. Just call Model.set to set those properties, in case there are any bindings using those properties as sources.

You can find examples of this by searching the sources of the samples.

thank you very much