Currently, I am using AngularJS to fetch JSON data like this:
$http.get('/balance').then(function (response) {
$scope.balance = response.data;
});
The value of response.data
is as follows:
{
"pending": [{
"amount": 16,
"currency": "usd"
}],
"available": [{
"amount": 20,
"currency": "usd"
}],
"livemode": false,
"object": "balance"
}
I am seeking guidance on how to sum up the two "amounts" and store the result in a variable within Angular. In this case, the variable should be assigned the value of 16+20
.