我使用的角度和火力地堡存储上传图片,我有这个问题在我的urlImg
它是undefined
,当我尝试打印它在console.log
的内部tap
。
this.snapshot = this.snapshot = this.task.snapshotChanges().pipe(
finalize(() => {
this.storage
.ref(path)
.getDownloadURL()
.subscribe(url => {
this.urlImg = url; // with this you can use it in the html
});
}),
tap(snap => {
if (snap.bytesTransferred === snap.totalBytes) {
// Update firestore on completion
//Code to upload on completion
console.log("url");
console.log(this.urlImg);
}
})
);