typescript - ref.getMetadata does not subscribe in AngularFireStorage
问题描述
I have recently updated to AngularFire 6.0 and I have been having issues with the AngularFireStorage. Once I upload an image and call ref.getMetadata().subscribe(...)
, there seems to be no data returning. Here is a snippet of my code:
this.ref = this.afStorage.ref(`${this.location}/tmp/${randomUUID}`);
this.task = this.ref.put(imageFile, { customMetadata: { blah: 'blah' } });
this.uploadProgress = this.task.percentageChanges();
this.task
.snapshotChanges()
.pipe(finalize(() => {
this.ref.getMetadata().subscribe(
(res: any): void => {
imgControl.setValue(res.fullPath);
imgControl.updateValueAndValidity();
this.setPreviewSrc(imageFile);
this.uploading = false;
},
(error: any): void => {
console.error(error);
this.error = true;
this.errorMessage = 'Something went wrong. Please retry.';
}
);
})
).subscribe();
I have tried calling this.ref.getDowloadUrl().subscribe(...)
and that works. Let me know what I am missing.
解决方案
推荐阅读
- javascript - GatsbyJS - 在 CSS 中使用 SVG 作为伪背景图像
- php - 我想从控制器访问对象的值到 Laravel Blade 文件
- php - 从 WooCommerce 中的特定产品属性术语名称获取产品
- javascript - 如何在Javascript中通过具有多个条件的对象属性对数组进行排序
- powershell - 如何在选择命令中获取变量值并重定向到powershell中的文件
- php - 如何在codeigniter中查看注册邮箱?
- c++ - GCC 对可能有效的代码抛出 init-list-lifetime 警告?
- mongodb - 查找文档并仅返回缺失值
- sql - 具有百分比分区和分组依据的 Postgresql 频率表
- javascript - TypeError :req.gravatar 不是函数