【问题标题】:How to use angular syntax in kendo chart templates如何在剑道图表模板中使用角度语法
【发布时间】:2016-09-04 07:02:02
【问题描述】:
在图表模板中使用角度语法时,它会显示为普通字符串。
我正在尝试将 text 的值添加到剑道图表轴标签。检查这个Sample
$scope.text = "hi";
$scope.valueAxisConfig = {
labels: {
template: '{{text}}#= kendo.toString(value, \'c0\') #'
}
}
【问题讨论】:
标签:
angularjs
kendo-ui
kendo-chart
【解决方案1】:
并非所有 KendoUI 模板都支持 AngularJS 表达式(至少据我所知)。
作为一种解决方法,您可以更改valueAxis.labels.template,它可以是string 或function returning a string。
您可以通过使用后者来实现所需的行为。
$scope.text = "hi";
$scope.valueAxisConfig = {
labels: {
template: function (item) {
return $scope.text + ' ' + kendo.toString(item.value, 'c0');
}
}
}
我还更新了你的Dojo。