【发布时间】:2018-10-14 15:28:43
【问题描述】:
我有很多项目:
export class Project {
$key: string;
file: File;
name: string;
title: string;
cat: string;
url: string;
progress: number;
createdAt: Date = new Date();
constructor(file: File) {
this.file = file;
}
}
我把它们都上传到:
uploads: Observable<Project[]>;
private saveFileData(upload: Project) {
this.db.list(`profile/${this.auth.userId}/project`).push(upload);
}
然后我想得到一个:
uploads: Observable<Project[]>;
getOne(){
this.uploads = this.db.list(`profile/${this.auth.userId}/project/${this.projectId}`);
}
在这种情况下,我在 this.uploads 上收到错误
(Angularfirelist 不能分配给 Observable。)
然后我尝试了这个:
uploads: AngularFireList<Project[]>;
getOne(){
this.uploads = this.db.list(`profile/${this.auth.userId}/project/${this.projectId}`);
}
错误:
错误错误: InvalidPipeArgument: '[object Object]' 用于管道 '异步管道'
如何获得那个项目?
【问题讨论】:
标签: angular typescript firebase firebase-realtime-database observable