I have run into a scoping problem when creating click functions on the nodes of my graphs built using Angularjs, Highcharts and the highcharts-ng directive.
The problem I am having is that any angular directives or functionality I place in my click function does not work.
Here is a simplified version of my problem - http://jsfiddle.net/47m46/8/
Once you click on a graph point/node html is generated which includes a button element with an ng-click directive placed on the button. However the function called in ng-click does not run and I have noticed no angular functionality generated by my highcharts click function works.
The author of the highcharts-ng directive mentioned in the following thread that "These events (click function) will be outside of the angular world though so you'll need to wrap them with an apply or similar."
So my question is: How do I place the functionality set in my highcharts click function inside of the angular context?
Kind Regards
An Angular learner driver
Hi Ocajian,
If you add new raw html to your page that contains angular directives, you should $compile that. Before or after inserting the part
your contentDiv.innerHTML contains a angular directive (ngClick). However, angular is not aware of this template. Hence, the ngClick does not fire.
As you are learning, I think it's a good idea if you try to figure out how to solve this on your own. Have a go at it, look at the $compile docs.
If you get stuck, come back, and ask for help, We will try to coach you.
Regards
Sander