I am trying to get normalized value of one array associated to different groups.
I don't want to add something new into the original array items, so I am returning new objects for normalized items for each group.
$scope.nomalizedItems = function (groupid) {
var groupItems = $scope.originalItems.filter(function (item) {
return item.groupid == groupid
});
var values = groupItems.map(function (item) {
return item.value;
});
var maxValue = Math.max.apply(null, values);
return groupItems.map(function (item) {
return {
id: item.id,
normalizedValue: item.value / maxValue
};
});
};
I believe this logic is really simple, however angularjs is always blaming "[$rootScope:infdig] 10 $digest() iterations reached. Aborting!
" even if I have added the "track by item.id
" in the ng-repeat expression.
Any idea how to solve this issue? Thanks!