I am new with Angular. I download JSON and then must handle it. I wrote something like a function:
for (var i = 0; i < $scope.Objects.length; i++){
$http.get($scope.Objects[i]["Commit"]).success(function(data) {
Commit = data;
})
.error(function(data, status, headers, config) {
alert("Sorry we have some troubles... Try another time");});
for (var j = 0; j < Commit.length; j++){
//Metrics
if (j = 0){
for (var k = 0; k < Commit[j].length(); j++){
if (Commit[j][k] < 40){
$scope.Objects[i]["State"] = "Rejected"
}
}
}
///////////////////////////////////////////////////////
//Build
if (j = 1){
for (k = 0; k < Commit[j].length(); j++){
if (Commit[j][k] == false){
$scope.Objects[i]["State"] = "Rejected"
}
}
}
///////////////////////////////////////////////////////
//UnitTests
if (j = 2){
if (Commit[j][0] > 15){
$scope.Objects[i]["State"] = "Rejected"
}
for (k = 1; k < Commit[j].length(); j++){
if (Commit[j][k] < 40){
$scope.Objects[i]["State"] = "Rejected"
}
}
}
///////////////////////////////////////////////////////
//FuncTests
if (j = 3){
if (Commit[j][0] > 2500){
$scope.Objects[i]["State"] = "Rejected"
}
for (k = 1; k < Commit[j].length(); j++){
if (Commit[j][k] < 40){
$scope.Objects[i]["State"] = "Rejected"
}
}
}
/////////////////////////////////////////////////////////
}
$scope.Objects[i]["Commit"] = Commit;
}`
but I can't handle it after $http because it isn't a $scope or even a function, I want use this piece of code how it is, like in pure JS. Is it possible.