【发布时间】:2021-08-22 11:16:47
【问题描述】:
ref: AngularFireStorageReference;
task: AngularFireUploadTask;
uploadState: Observable<string>;
uploadProgress: Observable<number>;
downloadURL: Observable<string>;
upload(event) {
const id = Math.random().toString(36).substring(2);
this.ref = this.afStorage.ref(id);
this.task = this.ref.put(event.target.files[0]);
this.uploadState = this.task.snapshotChanges().pipe(map(s => s.state));
this.uploadProgress = this.task.percentageChanges();
this.downloadURL = this.task.downloadURL();
}
以上来自guide。
我希望这会在上传完成到 Firebase 存储后获得下载 URL。但我得到这个错误:
TS2740:“Subscription”类型缺少“Observable”类型的以下属性:_isScalar、source、operator、lift 等 6 个。
【问题讨论】:
标签: angular typescript firebase firebase-storage angularfire2