I have defined a variable globally in typescript, within one function I am not able to get that variable using this
keyword
This is my code
imageTemplate.adapter.add("latitude", function(latitude, target) {
const ctx = target.dataItem.dataContext as any;
let polygon = this.polygonSeries.getPolygonById(ctx.id);
if(polygon){
return polygon.visualLatitude;
}
return latitude;
})
Getting error at this.polygonSeries.getPolygonById(ctx.id);
. Property polygonSeries does not exist
.
This is how I have declared polygonSeries
variable
public polygonSeries:any;
How can I solve this issue?
In the below answer in comment box, I came across lots of theory which I don't want. I am looking for solution.