kendo-labs / angular-kendo

A project to create a robust set of Angular.js bindings for Kendo UI widgets
474 stars 209 forks source link

Support for {{angular}} in DataViz.Chart tooltip template #348

Open MuadDib opened 10 years ago

MuadDib commented 10 years ago

I am guessing this is similar issue as was #182 Trying to use custom template as DataViz's chart tooltip, but Angular is not compiling it. {{ }}s are ignored and displayed as text. If you could share any workaround for this issue I would be most grateful.

Template:

DataViz chart definition: $scope.chart = { legend: { visible: true, }, series: [{ type: 'line', field: 'value', }], categoryAxis: { field: 'group' }, tooltip: { visible: true, template: kendo.template($('#tooltipTemplate').html()) } } $scope.test = 'test';

YonatanKra commented 10 years ago

More than that - here's an example where I can't get an external function to work in the template: http://plnkr.co/edit/AjYbRUplf6JVurIVvuOB?p=preview I've sent an official ticket to telerik, but I think many can benefit from a solution to this issue.

mishoo commented 10 years ago

@yccteam that's because your "external" (test) function is actually embedded in the controller function, thus hidden from the global scope. The Kendo template is evaluated in the global JS scope.

Here's the updated plunk where I made test global: http://plnkr.co/edit/Svjqxzc4XbmADF3JLiwI?p=preview

{{angular}} fragments in the Chart components are generally not supported for now, so I'm leaving this ticket open.

YonatanKra commented 10 years ago

Hi, Thanks. Of course I could do that, and that's how I did it without angular. But with Angular we have scope, and this "global" method pollutes the global name space etc. I guess that once {{angular}} pieces will be available, I'll be able to put $scope.test = function(value){...} as {{test(value)}} or something like that. Actually - I don't think that value would be available "out of the box". Is there/would there be a way to send the value to the function inside the angular expression?