mardi 30 décembre 2014

$evalAsync not working with AWS dynamodb call

I have an issue where an array ($scope.wallet) is not being updated with data from my dynamodb query. here is the query:



function queryForCoupon(couponID){
var couponParams = {
"TableName":"coupons",
"KeyConditions":{
"couponID" :{
"AttributeValueList":[
{
"S": couponID
}
],
"ComparisonOperator":"EQ"
}
},
"Select": "ALL_ATTRIBUTES"
}
db.query(couponParams,
function(err, data) {
if(err){
console.log(err);
} else {

$scope.$evalAsync(function () { $scope.wallet.push(data.Items[0]); });
}

});
}


When I console.log(data.Items[0]) the correct data is there, but later on when I console.log() on the wallets contents nothing is there. I've tried $scope.apply and $scope.timeout as well with no luck.


Any thoughts?





Aucun commentaire:

Enregistrer un commentaire