I'm using Angular 7 along with HighCharts. I'm passing a function to my high charts click event, but I also need to access some variable from the component.
Here is the code for my event:
events: {
click: function (e: any) {
console.log(this.xAxis[0].min)
console.log(this.componentVariable)
}
}
I can access the value of xAxis
but not the variable componentVariable
because it doesn't exist in the context. I cannot bind
this
to the function either, because then I won't have access to xAxis
.
How can I access both variables inside the callback click
function?
Here is a simple example of my problem.