TypeError: Cannot read properties of undefined (reading 'palette') @ Angular goJS

117 views Asked by At

Trying to remove the node at Palette upon a "ModelChanged" activity in angular, but seems not recognizing the palette at All..

// initialize diagram / templates
public initDiagram(): go.Diagram {

    const $ = go.GraphObject.make;
    let dia = $(go.Diagram, {
      'undoManager.isEnabled': true,
      'clickCreatingTool.archetypeNodeData': { text: 'new node', color: 'lightblue' },

      "ModelChanged": e => {
        if (e.isTransactionFinished) {
         this.myPaletteComponent.palette.commandHandler.deleteSelection();
          console.log(this.myDiagramComponent.diagram.model.nodeDataArray)
        }
      },
      model: $(go.GraphLinksModel,
        {
          nodeKeyProperty: 'id',
          linkToPortIdProperty: 'toPort',
          linkFromPortIdProperty: 'fromPort',
          linkKeyProperty: 'key' // IMPORTANT! must be defined for merges and data sync when using GraphLinksModel
        }
      )
});
0

There are 0 answers