I would like to combine two arrays on the same page to look up the right average rating for each cd, the cd list is in an ng-repeat and they can be matched both with the id_cd. How can i get the right average rating for each cd in the ng-repeat of the cd-listing?
I have the following codes in the landingpage.js
app.controller('LandingPageController',
   function LandingPageController($scope, $http) {
function GetAllCdRating() {
        $http({
            method: 'Get',
            url: "/LandingPage/GetAllCdRating"
        })
            .success(function (data) {
                $scope.AllCdRating= data;
         // the added section of Saurabh Agrawal
         $scope.getValue = function(cd){
             for (var i = 0; i < $scope.AllCdRating.length; i++) {
                 if ($scope.AllCdRating[i].id_cd == cd.id_cd) {
                 return $scope.AllCdRating[i].averageRating;
                 }
              }
          }
         })
}
GetAllCdRating();
// looks like this and holds about 200 records for now
[
 {
  "id": 1,
  "averageRating": 7,
  "id_cd": 13586
 },
 {
  "id": 2,
  "averageRating": 8,
  "id_cd": 13540
 },
 {
  "id": 3,
  "averageRating": 9,
  "id_cd": 13547
 },
 {
  "id": 4,
  "averageRating": 6,
  "id_cd": 13549
 }
]
   $scope.GetLastAddedCds = function () {
        $http({
            method: 'Get',
            url: "/LandingPage/GetLastAddedcds"
        })
            .success(function (data) {
                $scope.lastcds = data;
            })
    }
    $scope.GetLastAddedCds ();
// looks like this and holds about 5000+ records
[
 {
  "id_cd": 13586,
  "cdName": "the greatest hits",
 },
 {
  "id_cd": 13606,
  "cdName": "live or die",
 }
]
}
so far for the body section:
<div ng-controller="LandingPageController">
  <div class="srollcell" ng-repeat="cd in lastcds">
   <div>{{cd.title}}</div>
    <div>
       {{getValue(cd)}}
    </div>
  </div>
</div>
So i added your section Saurabh Agrawal (thanks) but somehow it seems it doesn't count up [i] it stays on '0'
 
    