Slava Slava - 1 year ago 64
Javascript Question

Gettting data from firebase not woks

I init my web app with firebase, then I add new data into database: {'title': 'hello world!'}. Then I try to get this data:

and I got strange object:
enter image description here

How to get my data?
Firebase version: 3.4.0

Answer Source

Firebase queries are asynchronous. Hence, you need to register a callback so that Firebase can inform you when the results are ready.

Try this:

database.ref().child('title').on('value', (snapshot) => {

You may read this for more information.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download