【发布时间】:2020-05-27 17:09:14
【问题描述】:
我正在订阅 Firestore 中的一个集合。一旦返回值,我想对该数据执行一些操作。做这个的最好方式是什么?我遇到了一个类似的问题,导致我编写了下面的代码。但是,该代码似乎不会等到值出现。
this.versionCollection = this.FirebaseService.getCollection('versions', 'projectId', this.projectData.uid )
.subscribe(()=>{
// Actions to be carried out after the data is returned
this.versionData = this.versionCollection[this.versionCollection.length];
this.initializeMenu();
this.initializeModel();
});
afs 为 AngularFirestore 的服务中调用的代码...
getCollection( collection, paramName, paramValue ) {
return this.afs.collection( collection, ref => ref.where( paramName, '==', paramValue )).valueChanges();
}
【问题讨论】:
标签: angular google-cloud-firestore angularfire2