Answer the question
In order to leave comments, you need to log in
How to deal with arrays?
A query to the database returns an object in which each row is also an object.
You need one object so that its properties can be inferred from $scope in a loop.
I.e:
{
0 {
name: "Вася"
},
1 {
name: "Петя"
}
}
[
{name: "Вася"},
{name: "Петя"}
]
$cordovaSQLite.execute(db, query).then(function(res) {
var rows = [];
for (i in res.rows) {
rows.push(res.rows[i]);
}
console.log(rows);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question