i m working on an app that us angular and gojs, when ever i call a function from diagram of angular class it gives me error
TypeError: Cannot read property ‘service_call’ of undefined
the diagram is as follows
the error is as follows
i m working on an app that us angular and gojs, when ever i call a function from diagram of angular class it gives me error
TypeError: Cannot read property ‘service_call’ of undefined
the diagram is as follows
the error is as follows
I’m just guessing here, but are you using this
inside an event handling function?
In GoJS, all properties that take functions as values never bind this
when calling the function. This makes it easier to use arrow functions.
In GoJS, only instance methods of classes have this
bound, as happens naturally for all calls to methods defined on prototypes.
well i didnt understand what u r saying
i just want to call a http service on buton click of diagram
and change the model
How did you define the event handler that is producing that error? Did you use function(. . .) { . . . }
instead of (. . .) => { . . . }
?
Before your service_call()
, check the value of this
.
its undefined have u any idea y?
My guess is that you are passing the drillup
function as the GraphObject.click event handler, but its operation as a method on whatever class you defined it in obviously depends on this
being bound to that object.
So you need to call drillup
in your click event handler function.
and how exactly do i do that ? any example or code snippit if possible