1

I am trying to create a tree model with a set of links and nodes. I have it in my jsfiddle using javascript it works fine. I am trying to replicate the same in angular. I could not find any helpfull info. I am getting the below error when i try to pass the same as i did in javascript.

  this.myDiagram.model = new go.TreeModel({
            nodeParentKeyProperty : "Boss",
            nodeDataArrayProperty
        });

Here's the working javascript version of the code : https://jsfiddle.net/pandiyancool/58os19nt/6/

Error message shown in vscode

Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87
HariHaran
  • 3,642
  • 2
  • 16
  • 33

2 Answers2

1

Use the TreeModel of gojs like below

const $ = go.GraphObject.make;
....
this.myDiagram.model = $(go.TreeModel, {
    nodeParentKeyProperty: "boss",
    nodeDataArray: nodeDataArrayProperty
});
Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87
0

The TreeModel constructor does not take an Object specifying options. It only takes an optional Array of data. https://gojs.net/latest/api/symbols/TreeModel.html

If you do want to set various properties on a new instance of TreeModel, use the static GraphObject.make function: https://gojs.net/latest/api/symbols/GraphObject.html#.make

Walter Northwoods
  • 4,061
  • 2
  • 10
  • 16