My task involves retrieving multiple http.get requests from a server with different json sets.
After processing each "physical" data set, I need to perform a calculation that requires the value from the corresponding "virtual" call. This calculation is handled by a function called "Calculate" (refer to code snippet below)
Most of the time, this process works smoothly and accurate values are generated. However, there are instances where the $http.get requests do not finish in time, resulting in the values remaining at 0.
How can I ensure that both http.get requests for the physical and virtual calls complete successfully for every "cluster"?
function($scope, $http) {
// Code logic for handling multiple http.get requests...
function calculate(string, type, virtual, physical) {
console.log(type + " capacity " + string + ": " + (virtual / physical).toFixed(2) * 100 + "%");
}
}]);