title: In AngularJs set a variable in forEach for each object
body: <p>I am trying to run a forEach function with data from a query and I want to set a variable for each object in that data to be able to use in a ng-repeat. I keep overriding the variable and cannot wrap my head around setting the variable for each one.</p>
  
  <pre><code>CategoryCardService.query({}, function (data) {
              $scope.categoryCards = data;
              angular.forEach(data, function (value) {
                  var categoryOccupancyPercent = $filter('number')(value.occupancy_percent * 100, 0);
                  var categoryTotalTurnover = value.total_turnover;
  
                  var doughnut_chart_min = 0;
                  var doughnut_chart_max = 0;
  
                  doughnut_chart_min = categoryOccupancyPercent;
                  doughnut_chart_max = 100 - categoryOccupancyPercent;
  
                  data.doughnutData = [doughnut_chart_min, doughnut_chart_max];
                  data.display = categoryOccupancyPercent + '%';
  
              });
  
  
          });
  </code></pre>