Highcharts:处理ng点击工具提示 [英] Highcharts: Handling ng-click on tooltips

查看:77
本文介绍了Highcharts:处理ng点击工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助解决我遇到的问题。我创建了一个图表和一个自定义工具提示,无论用户何时点击工具提示,都应该调用$ scope函数。

  tooltip :{
pointFormatter:function(){
return $ compile(angular.element(< p style ='color:red'ng-click ='handleClick()'>点击这里< / p>中))(范围);
}
}

我创建了一个 jsfiddle

谢谢!


在出现工具提示后编译工具提示元素。



在pointFormatter返回字符串中:

  pointFormatter:function(){
return< p style ='color:red'ng-click ='handleClick )'>点击此处< / p>
}

在点击回调中:

  events:{
click:function(e){
tooltip.refresh(e.point,e);
$ compile(tooltip.label.div)(scope)
}

例如: http://jsfiddle.net/mj9mj1n5/


I need some help with a problem I am encountering. I created a chart and a custom tooltip, whenever the user clicks on the tooltip, it should call the $scope function.

        tooltip: {
            pointFormatter: function() {
              return $compile(angular.element("<p style='color:red' ng-click='handleClick()'>Click here</p>"))(scope);
            }
        }

I created a jsfiddle for it.

Thanks!

解决方案

Compile the tooltip element after the tooltip appears.

In the pointFormatter return string:

pointFormatter: function() {              
  return "<p style='color:red' ng-click='handleClick()'>Click here</p>"
}

In the click callback:

events: {
  click: function(e) {
    tooltip.refresh(e.point, e);
    $compile(tooltip.label.div)(scope)
  }

example: http://jsfiddle.net/mj9mj1n5/

这篇关于Highcharts:处理ng点击工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆