I am trying to migrate code from Visualforce (working) to a Lightning Component. The update method should draw a graph and redraw it when the root node changes. I believe I am declaring the methods correctly but when I call "update" I get the above error. I've tried changing the function name in case it was a reserved keyword but get the same error. Any Suggestions?? Many thanks
Code looks like the following...
({
doInit : function(component, event, helper) {
var action = component.get("c.getNodeJSON");
action.setCallback(this, function(response){
var data = JSON.parse(response.getReturnValue());
component.set("v.root", data);
update(component, root);
});
$A.enqueueAction(action);
},
update : function(component, source) {
var root = component.get("v.root");
// etc etc
}
})