$scope.indexOfField = function(fieldId) { var fieldData = $scope.model.fieldData, i = 0, ii = $scope.model.fieldData.length; for(i; i < ii; i++) if(fieldData[i].Id === fieldId) break; // use i }