这是为了angularforestorage,我上传了一个图片后,我计划得到下载的url,但问题是,用于observate的管道不工作,我还试图使用{tap}但没有成功。
这是密码
const path = `hospital/${new Date().getTime()}_${file.name}`;
const customMetadata = { app : 'PROV-H meta'};
const ref = this.storage.ref(path);
this.task = ref.put(file,{customMetadata});
this.percentage = this.task.percentageChanges();
this.snapshot = this.task.snapshotChanges().pipe(
finalize(()=>{
console.log("percent finalize");
})
);
这是控制台的日志。
XHR finished loading: GET "http://localhost:4200/sockjs-node/info?t=1540028075438".
https://firebasestorage.googleapis.com/v0/b/prov-h-fae96.appspot.com/o?name=hospital%2F1540028079723_caps.png
".
仅供参考,如果无法使回调工作,则无法订阅下载URL。
this.snapshot = this.task.snapshotChanges().pipe(
finalize(()=>{
console.log("percent finalize"); //THIS IS NOT GETTING CALLED;
})
);