[Chartjs]-Expression in data attribute for angular chart.js

1👍

You could have something like this, I’m not sure this will work or not

Call an getTheData on rendering of DOM, you should pass item inside that method instead of item.value

<div ng-repeat="item in items" ng-init="getTheData(item)">
    <canvas data="item.data"></canvas>
</div>

Code

$scope.getTheData = function(item){
  getData[item.value]().then(function(data){
      item.data = data;
      console.log(data);
    });
};

So inside the success of getData function you need to set item.data value that will get passed to canvas data attribute.

Leave a comment