export class Pruebas{
FuncionPruebas() {
this.resultado=[];
this.database.executeSql("SELECT * FROM items", [])
.then((data) => {
this.items = [];
if(data.rows.length > 0) {
for(var i = 0; i < data.rows.length; i++) {
this.items.push(data.rows.item(i));
this.database.executeSql("SELECT * FROM imagenes", [])
.then((data) => {
this.imagenes = [];
if(data.rows.length > 0) {
for(var i = 0; i < data.rows.length; i++) {
this.imagenes.push(data.rows.item(i));
}
this.resultado.push(this.imagenes)
}
}, (e) => {
console.log("Errot: " + JSON.stringify(e));
});
}
this.resultado.push(this.items)
console.log("RESULTADO FINAL: " + JSON.stringify(this.resultado));
//la cosa es como consigo completar el array "resultado" con this.items y this.imagenes y que se devuelva la variable resultado con todo incluido. El problema que me encuentro que despues del then primero solo mete en resultado ese.
}
}, (e) => {
console.log("Errot: " + JSON.stringify(e));
});
}
}