简体   繁体   English

使用angularfire2和angular 4检索数据

[英]Retrieving data with angularfire2 and angular 4

My database is given here . 我的数据库在这里给出。 I want to retrieve the total data tree of Post with the key under Post 我想与下的键检索的总数据树

I have tried with the code given below. 我尝试了下面给出的代码。 but this provides me a list with 0 1 2 3 instead of original key ( KxZPLJh9k4ldXqz3gNF ) under Post 但这为我提供了一个0 1 2 3列表,而不是Post下的原始密钥(KxZPLJh9k4ldXqz3gNF)

this.db.list('/post', ref => ref.orderByChild('course').equalTo("che101f")).valueChanges();

Is there any way to have my desired data tree ? 有什么办法可以得到我想要的数据树? If so how ? 如果可以,怎么办?

valueChanges() strips the metadata, it's only intended for simple access to your JSON tree. valueChanges()剥离元数据,仅用于简单访问JSON树。

You should use snapshotChanges() if you want to access anything other than the JSON tree, such as pushIds. 如果要访问除JSON树以外的任何内容(例如pushIds snapshotChanges()则应使用snapshotChanges()

Check out the docs here . 在此处查看文档

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

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