My Firebase real-time database contains two data objects: Tweets
and Users
. Each tweet
object includes a property called userid
. I want to retrieve the user's name associated with each tweet.
Currently, I am attempting to achieve this with the following code:
<ion-item *ngFor="let tweet of tweets| async" >
{{(af.database.object('/Users/'+tweet.userid+'/name') | async)}}
</ion-item>
This code successfully retrieves the JSON data, but I am having trouble extracting just the value. When I attempt to debug using the |json pipe:
<ion-item *ngFor="let tweet of tweets| async" >
{{(af.database.object('/Users/'+tweet.userid+'/name') | async | json)}}
</ion-item>
I can see the following JSON output:
{
"$value": "username",
"$key": "name"
}
However, my desired output is simply the username. How do I extract only that value?