In my code, I have implemented an ng-repeat
. Each alternate div inside the ng-repeat
is supposed to have a different border-color
, which is achieved by using the following structure:
<div ng-repeat="channel in channelList">
<div ng-style="getBgColor()">
</div>
The function getBgColor()
is defined as follows:
$scope.currentColorIndex = (($scope.currentColorIndex+1) % $scope.radioColors.length);
$scope.tileColor = $scope.radioColors[$scope.currentColorIndex].hex;
return $scope.tileColor;
However, I keep encountering the error:
$rootScope:infdig] 10 $digest() iterations reached
I understand that this error occurs because a different object is returned on each iteration of the ng-repeat
. What could be a possible solution or workaround for this issue?