The final result:
I'm a little confused as to what you're trying to do, exactly, but here's what I did to your fiddle:
I changed
onLoad
toNo wrap - in <body>
.You had an angular external resource AND angular in the framework - that was causing issues. So I took out the external resource.
In your controller declared an object on the scope called
evaluations
that has a property calledeval
. In your view, though, you try to callrating
onevaluations
. Your data isn't structured like that. It looks like you want alternatives in the columns and criterion in the rows, so we need to put your data in a format so that it can be indexed in that fashion. It's conventional to have rows of columns, so I will make the data be indexed by criterion and then alternative. To do this I wrote the following:$scope.evaluations = {}; for (var i = 0; i < allEvals.length; i++) { if (!$scope.evaluations.hasOwnProperty(allEvals[i].criterion)) { $scope.evaluations[allEvals[i].criterion] = {}; } $scope.evaluations[allEvals[i].criterion][allEvals[i].alternative] = allEvals[i].rating; }
And then in your view:
<input id="#{{alternative.id}}" type="text" value="{{evaluations[criterion.name][alternative.name]}}" />
Please let me know if you need any more assistance :)