0
        for (var siteCounter = 0; siteCounter < audit.SessionSiteList.length; siteCounter++) {
        for (var itemCounter = 0; itemCounter < audit.SessionSiteList[siteCounter].AuditItemList.length; itemCounter++) {
            var item = audit.SessionSiteList[siteCounter].AuditItemList[itemCounter];

           item.TotalItems = audit.SessionSiteList[siteCounter].AuditItemList.length;
            item.CurrentItem = itemCounter;

            promises.push(function(){return $scope.submitaudit(item)});
        }
    }

When the promises are executed, they are all using the same data. ie the last assigmnet to item gets used by all promises. How do i pass by value?

Can i clone the data and pass that?

Daniel
  • 3,541
  • 3
  • 33
  • 46
user2520306
  • 27
  • 1
  • 9

0 Answers0