简体   繁体   English

在angularfire2 v5中包含$ key

[英]Include $key in angularfire2 v5

Actually i need to get the $key in this AngularFireList, but i don't know how i do that, actually this is my code to a list, that works but don't rerieve the data with the $key: 实际上我需要在此AngularFireList中获取$ key,但是我不知道该怎么做,实际上这是我的列表代码,可以工作,但不要使用$ key检索数据:

getAutosByPlaca(placac: string): Observable<Auto[]> {
 const placa$ = new Subject().startWith(placac);
 return placa$.switchMap(placa => {
  return this.db.list(this.dbPath, ref => ref.orderByChild('placa').equalTo(placac)).valueChanges();
 });
}

valueChanges() returns the unpacked data. valueChanges()返回解压缩的数据。 To get the meta data, you need snapshotChanges(), as documented here: 要获取元数据,您需要如此处记录的snapshotChanges():

https://github.com/angular/angularfire2/blob/master/docs/rtdb/lists.md#angularfireaction---action-based-api https://github.com/angular/angularfire2/blob/master/docs/rtdb/lists.md#angularfireaction---action-based-api

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM