如何在 kendo 图表模板中使用 angular 语法
How to use angular syntax in kendo chart templates
在图表模板中使用 angular 语法时,它显示为普通字符串。
我正在尝试将 text
的值添加到 kendo 图表轴标签。检查这个 Sample
$scope.text = "hi";
$scope.valueAxisConfig = {
labels: {
template: '{{text}}#= kendo.toString(value, \'c0\') #'
}
}
并非所有 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。
在图表模板中使用 angular 语法时,它显示为普通字符串。
我正在尝试将 text
的值添加到 kendo 图表轴标签。检查这个 Sample
$scope.text = "hi";
$scope.valueAxisConfig = {
labels: {
template: '{{text}}#= kendo.toString(value, \'c0\') #'
}
}
并非所有 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。