I have the following method:
$http({
method: 'GET',
url: '../ws/parqueos'
}).then(function (success){
$scope.parqueos = success.data.records;
for($scope.parqueosDisponibles in $scope.parqueos)
{
console.log($scope.parqueos[$scope.parqueosDisponibles]);
}
},function (error){
});
variable $scope.parqueos = success.data.records;
stores what comes in the next JSON, exactly in the property "records":
{
"message": "Consulta Exitosa: Parqueos",
"result": true,
"records": {
"id_info": 2,
"estac1": 1,
"estac2": 1,
"estac3": 1,
"estac4": 1,
"estac5": 0,
"estac6": 0,
"estac7": 0,
"estac8": 0,
"estac9": 1
}
}
It turns out that I have to perform a counter for the estac1, estac2, estac3, estac4, estac5, estac6, estac6, estac8, estac8, estac8 properties, when these have value 1, I must add up in order to obtain a total of available parking spaces, but not I must take into account the property of the records object, "id_info": 2,
for them I'm using this structure:
for($scope.parqueosDisponibles in $scope.parqueos)
{
console.log($scope.parqueos[$scope.parqueosDisponibles]);
}
but it goes through all the values of the object. How can I start from the second property of object records
?
or any other solution to my problem?