Setting the ports while instantiating the GraphLinksModel

Based on the sample about the ports (GoJS Ports in Nodes-- Northwoods Software), there are a few weird things:

  1. using $ to create GraphLinksModel does not sound correct. Since $ is a shorthand for GraphObject.make and since Model does not seem to extend the GraphObject
  2. The instantiation is done with an object, whereas the documentation for the GraphLinksModel’s constructor mentions only passing 2 arguments: nodeDataArray and linkDataArray

So, how can I, correctly, set the ports while instantiating the model?

Yes, the constructor only takes the two Arrays. If you don’t want to call GraphObject.make, which can build instances of any class that has a default constructor, you could do:

var m = new go.GraphLinksModel();
m.linkFromPortIdProperty = ...
m.linkToPortIdProperty = ...
m.nodeDataArray = ...
m.linkDataArray = ...

Or you could do:

    linkFromPortIdProperty: ...,
    linkToPortIdProperty: ...,
    nodeDataArray: ...,
    linkDataArray: ...