I'm trying to execute a function, which I have a call from another function inside a loop , however the return
of the function only loads the first method entry. So, how do I call a method inside a loop ? Here is the code:
function 1:
componentesGrafico() {
var i, j;
var valores;
console.log(this.arraySlide[i]);
for (i = 0; i < this.arraySlide.length;i++) {
valores = this.db.queryDatabase(this.arraySlide[i]);
console.log(valores);
}
function 2:
queryDatabase(id) {
var grupo = '/EMPRESA/COMPBI/';
var db = this.afd.database.ref(grupo).orderByKey();
var valores = new Array();
db.startAt(id).endAt(id+"\uf8ff").on("child_added",function (snapshot) {
valores.push(snapshot.key);
console.log(snapshot.key);
});
return valores;
}