I define active
in my class. I would like to access the value of active
within my Dragula code. When I console.log
my this.active
I get undefined
. It seems that at this point of my code this
refers to my Dragula object and not the variables I have declared at the start of my class.
How can I access the value of active
within my Dragula code?
export class GamePage {
active = [];
inactive = [];
constructor() {
this.dragulaService.setOptions('drop-'+this.tableID, {
revertOnSpill: true,
direction: 'horizontal',
moves: (el, source, handle, sibling) => this.checkPlayerCanBeDragged(el.id),
accepts: function (el, target, source, sibling) {
console.log('inactive', this.inactive);
return true;
}
});
}
}