0
You would need to create a new array from the return of the Firebase image URL
The newImgList array receives nothing.
task ts.
imgList: [];
newImgList: any = [];
constructor(...) {
this.tarefaId = this.navParams.get('tarefaId');
this.imgList = this.navParams.get('imgList');
this.listImage(this.tarefaId);
this.getTarefa();
}
listImage (tarefaId: string) {
for (let i = 0; i < this.imgList.length; i++) {
let storageRef = firebase.storage().ref();
let imageRef = storageRef.child(`tarefas/${tarefaId}/${this.imgList[i]}`);
imageRef.getDownloadURL().then(function (url) {
this.newImgList.push(url);
}).catch(function (error) {
alert("erro");
});
}
}
What error are you getting?
– Eduardo Vargas
is not populating the "newImgList" array. if I give an empty console.log to it.
– Ezequiel Tavares
it will only be populated within the then pq is asynchronous
– Eduardo Vargas
@Eduardovargas, I’m kind of raw at it. I could exemplify?
– Ezequiel Tavares