Expression in data attribute for angular chart.js

Hi I have tried using an expression inside the data attribute like this

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

and in the controller

var getData = {
    first: function(){ return angularFactory.getData() };
    second: function(){ return angularFactory.getData() };

$scope.getTheData = function(value){

my plan is to get only the needed data from factories based on what items the user load.

the problem is this is resulting in [$rootScope:infdig] with a log that never stops even though I just have one item in the "item" list.

Am I doing this wrong?


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=""></canvas>


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

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

Need Your Help

Ranking items in a list with LINQ

c# .net linq

I am trying to figure out a way to rank items in a list, and hold the results in an object or another list. I know about the orderby method, but I don't exactly know how to go about creating a

Using a user defined variable within a function? (Ruby, Watir)

ruby watir

I'm creating drag and drop feature that depends on upon ID for placement, it works perfectly fine, but I need the status of task to be user defined so the user will have control of where something ...