javascriptangularangular7gojstreemodel

How to use goJs TreeModel in angular 7


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


Solution

  • Use the TreeModel of gojs like below

    const $ = go.GraphObject.make;
    ....
    this.myDiagram.model = $(go.TreeModel, {
        nodeParentKeyProperty: "boss",
        nodeDataArray: nodeDataArrayProperty
    });