【发布时间】:2018-02-14 15:15:46
【问题描述】:
我在我的 angularjs 项目中使用 echarts。如果可能的话,我宁愿不必使用 ng-echarts 模块。我希望能够在图表对象上获得一个单击事件,以更改 $scope 上可用于切换 ng-show 的变量的值
我在控制器中的代码是这样的:
myChart = echarts.init(document.getElementById('main'));
// code that prepares the graph data goes here
// ...
myChart.setOption(option,true);
myChart.on('click', function(e) {
//this works fine
console.log(e)
// this does nothing
$scope.showDiv = true //this does nothing
})
有没有办法让$scope.showDiv = true 在视图中实际处理<div ng-if="showDiv">test</div>?
我已经搜索了文档和其他来源,但找不到任何东西。
【问题讨论】: