Skip to content
Advertisement

FIREBASE getting document data

I’m making an app and trying to get product data by it’s id inside a modal in ionic 4. I’m using typescript to do it but without luck. Because de calls to firebase are asynchronous i cannot get the data that is held in firebase and also because i’m new to subject i cannot figured out the proper way to write the code. I read about how to do it but i’m having a hard time to achieve it.

Here is my function that tries to grab product data from firebase. It always logs empty on console.log(‘todo’, todo).

JavaScript

Advertisement

Answer

There is something wrong with your “getTodo”. Probable you are logging empty data with your code, I can give you the proper functional example:

JavaScript

GOOGLE EXAMPLE

JavaScript

https://firebase.google.com/docs/firestore/query-data/get-data?hl=es

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement