mahindar mahindar - 3 months ago 16
AngularJS Question

How to use angular syntax in kendo chart templates

when using angular syntax inside chart template it is getting displayed as normal string.

I'm trying to add value of

text
to the kendo chart axis label. check this Sample

$scope.text = "hi";
$scope.valueAxisConfig = {
labels: {
template: '{{text}}#= kendo.toString(value, \'c0\') #'
}
}

Answer

Not all KendoUI templates support AngularJS expressions (for all I know atleast).

As a workaround you can change the valueAxis.labels.template, which can either be a string or a function returning a string.

You can achieve the desired behavior by using the latter one.

$scope.text = "hi";
$scope.valueAxisConfig = { 
    labels: { 
        template: function (item) {
            return $scope.text + ' ' + kendo.toString(item.value, 'c0');
        }
    } 
}

I've also updated your Dojo.