I am trying to create charts( Using Chart.js Lib ) using ng-repeat.
EDIT : PLUNKER
HTML:
<div class="graph-display" ng-controller="jsonServerBox">
<div class="bar-chart-box" ng-repeat="module in ocw.modules">
<canvas class="chart chart-bar" data="{{module.data}}" labels="{{module.labels}}" series="{{module.series}}"></canvas>
</div>
</div>
JS:
app.controller('jsonServerBox', function($scope, $http) {
var json = {"modules":[
{
"series":"SeriesA",
"data":["90", "99", "80", "91", "76", "75", "60", "67", "59", "55"],
"labels":["01", "02", "03", "04", "05", "06", "07","08","09","10"]
},
{
"series":"SeriesB",
"data":["90", "99", "80", "91", "76", "75", "60", "67", "59", "55"],
"labels":["01", "02", "03", "04", "05", "06", "07","08","09","10"]
}
]};
$scope.ocw = json;
});
And I'm getting following error:
Syntax Error: Token 'module.data' is unexpected, expecting [:] at column 3 of the expression [{{module.data}}] starting at [module.data}}].
Please help.
See Question&Answers more detail:
os