Open Granaat opened 5 years ago
@Granaat Can you please provide more info. What are you trying to achieve?
The objective is to be able to use "this" as the parent component in angular so I can bind to custom functions end component variables without passing callbacks or inline functions.
i.e.
manipulation: {
enabled: false,
addNode: (data, callback) => {
this.actionService.addNode(data, callback)
},
editNode: (data, callback) => {
this.actionService.addNode(data, callback)
},
addEdge: (data, callback) => {
if (data.from == data.to) {
var r = confirm("Do you want to connect the node to itself?");
if (r == true) {
this.actionService.addEdge(data, callback)
// callback(data)
}
}
else {
this.actionService.addEdge(data, callback)
// callback(data)
}
this.actionService.resetMode()
},
editEdge: (data, callback) => {
this.actionService.editEdge(data, callback)
},
deleteNode: (data, callback) => {
this.actionService.deleteSelection(data, callback)
},
deleteEdge: (data, callback) => {
this.actionService.deleteSelection(data, callback)
},
...
I've bypassed the (typescript) error at the moment by ignoring the option 'init' in the errorcheck of the options class.
Allowing the function below in the options object would be a great help to use custom functions. It works atm but throws an error in the console.