I am using this code and unable to figure out how to populate the data form the database into an ionic list
$scope.selectAll = function() {
$scope.allSessions= [];
var query = "SELECT * FROM tb_sessions7";
$cordovaSQLite.execute(db, query, []).then(function(res) {
if(res.rows.length > 0) {
console.log("SELECTED -> " + res.rows.item(0).name + " " + res.rows.item(0).amount);
for (var i=0; i<res.rows.length; i++) {
$scope.allSessions.push(res.rows.items(i).name);
//console.log("data->"+$scope.allSessions);
}
} else {
console.log("No results found");
}
}, function (err) {
console.error(err);
});
}
Aucun commentaire:
Enregistrer un commentaire