Passing parameters to promise's callback in angularjs
you can use a closure for that.
for example, in your code, use something like:
function callbackCreator(i) {
return function(executionSteps) {
$scope.study.cases[i].executionSteps = executionSteps;
}
}
StudyService.studies.get({id: $routeParams.studyIdentifier})
.$promise.then(function(study) {
$scope.study = study;
for(var i=0;i<study.cases.length;i++) {
var callback = callbackCreator(i);
StudyService.executionsteps.get({id: $routeParams.studyIdentifier,caseId:study.cases[i].id})
.$promise.then(callback);
}
});