I am having trouble assigning the value of "$scope.returnPollings[i]" to "plrtn" during the loop. "$scope.returnPollings" is an object with a data and i can confirm there is a data in it when i console.log it.
db.transaction (function(tx) {
var sql = "INSERT INTO STATUSREPLY (reply, name, userCode, icon, target, repliedDate) VALUES (?, ?, ?, ?, ?, ?)";
var len = $scope.returnPollings.length;
var plrtn;
for (var i = 0; i < len; i++) {
plrtn = $scope.returnPollings[i]; // value is not being assigned here
tx.executeSql(sql, [plrtn.message, plrtn.name, plrtn.userCode, plrtn.qWink, plrtn.target, plrtn.createdDate ],
function(){
$scope.$apply(function(){
$scope.returnFstatus.push({
'message':$scope.ie.message,
'createdDate':$scope.ie.createdDate,
'icon':$scope.ie.qWink,
'target':$scope.ie.target
});
})
console.log('Status Inserted');
},function(tx, error) {
console.log('polling INSERT ERROR: ' + error.message);
});
}
});
I will be glad if anyone can help me