Thursday 15 March 2012

javascript - Add ng-click to highcharts-ng column chart xAxis labels -


I am using highchart-ng within an angular app, let me run a function after viewing the xx label below The categories and labels I am adding to charts are required.

Currently, I can add an onclick to the label and alert, but it is not able to work with angular.

  return "& lt; one onclick = 'warning (1)' & gt;" + This.value + "& lt; / a & gt;";  

An example of the current code is working here.

Until the $ compilation is called, the angular instructions are not processed, which are usually But then it is done when angular inserted templates are for example instructions and ng-if you modify yourself to doom, then angular does not know much with HTML, unless you do not compile $ yourself DOM After being revised by the High Charch-NG, you get $ Ideally you want the element one element to be computed:

  $ compilation (element) (scope)  

If I have not been compiled in advance (I am unsure what happens if it is not) and Scope Moving the top of the DOM tree in the first radius, if the scope of the scope is required If not, you can attach the element to just $ Root Scope.

If you have to compose $ compile (as well as $ Rootscope if you describe it) for more information, see this, which also tells you the strange syntax of the $ combible expression. If I post the code, I can tell you where the $ compile statement is located and how to find the appropriate area to use.

EDIT: One here is working JSFiddle:


No comments:

Post a Comment