jtblin / angular-chart.js

Reactive, responsive, beautiful charts for AngularJS using Chart.js: http://jtblin.github.io/angular-chart.js
Other
2.67k stars 761 forks source link

Receive a $parse:syntax error when attempting to bind to output expression #355

Closed richfergus closed 8 years ago

richfergus commented 8 years ago

I believe this is expected behavior, but it would be nice to have the attribute evaluate expressions. This would be especially nice when charts are part of a ngRepeat directive.

controller:

$scope.myKeys= countElementData.keys;
angular.forEach(countElementData[index], function(ac) {
        $scope.myDynamicData[index]=ac;
}

html:

<div ng-repeat="(key, value) in myKeys">
        <canvas tc-chartjs-pie  chart-data="{{key}}"></canvas>
</div>

perhaps something like this:
ng-attr-chart-data="{{key}}"

using angular interpolation

jtblin commented 8 years ago

Sorry I'm think there is a bit of confusion, the chart-data attribute is not a canvas attribute so prefixing with ng-attr- is not going to make any difference. Similarly chart-data is not an attribute and it expects an array of elements so it is not a good candidate for interpolation which per the link you mention "is used by Angular to provide data-binding to text nodes and attribute values.".