Amcharts Click Event In Angular 2 Not Working
Here is my codebase export class myComponent implements OnInit { minHist; maxHist; } public callAmcharts(whichFilterType:String){
Solution 1:
Change
this.amchart.addListener("clickGraphItem",this.myfunc);
to
this.amchart.addListener("clickGraphItem",this.myfunc.bind(this));
Depending on your inputs this will also work:
this.amchart.addListener("clickGraphItem",(e)=>this.myfunc(e));
which is the shorter version of:
this.amchart.addListener("clickGraphItem",(e)=> { returnthis.myfunc(e); });
Suggested reading: How to access the correct `this` context inside a callback?
Post a Comment for "Amcharts Click Event In Angular 2 Not Working"