Hi Experts,
Below is the structure of my classes inside firebase:
{
"groups" : {
"-KjkdYVP3N69GaDfLwS1" : {
"groupname" : "Ballet Class",
"description" : "8 years onwards",
"picture" : "assets/img/dance.jpg",
"type" : "dance"
},
"-KjkdYVP3N69GaDfLwS2" : {
"groupname" : "Ballet Class",
"description" : "8 years onwards",
"picture" : "assets/img/dance.jpg",
"type" : "dance"
},
"-KjkdYVP3N69GaDfLwS3" : {
"groupname" : "Ballet Class",
"description" : "8 years onwards",
"picture" : "assets/img/dance.jpg",
"type" : "dance"
},
"-KjkdYVP3N69GaDfLwS4" : {
"groupname" : "Ballet Class",
"description" : "8 years onwards",
"picture" : "assets/img/dance.jpg",
"type" : "dance"
}
},
"linking" : {
"DCuf5MvTlpQa0LC4BoJWedIiFfc2" : {
"groupid" : {
"-KjkdYVP3N69GaDfLwS1" : true,
"-KjkdYVP3N69GaDfLwS2" : true,
"-KjkdYVP3N69GaDfLwS3" : true,
"-KjkdYVP3N69GaDfLwS4" : true
},
"memberid" : {
"-KjkdduprKpr8e0P7KH1" : true,
"-KjkdduprKpr8e0P7KH2" : true,
"-KjkdduprKpr8e0P7KH3" : true,
"-KjkdduprKpr8e0P7KH4" : true
},
"role" : "admin",
"uid" : "DCuf5MvTlpQa0LC4BoJWedIiFfc2"
}
},
}
I have 2 classes ‘linking’ and ‘groups’. Once user logs in, i want to fetch the details of the user groups from the linking table and further want to fetch group details on the basis of group id’s return by first query. I write both of these queries independently:
Fetching groups from linking class:-
this.groupid = this.af.database.list(’/linking/’+uid +'groupid);
Fetching details of the groups:
this.groupdetails = this.af.database.list(’/groups’+this.groupid);
But i know this code is not valid.
Can someone please suggest right way to handle this requirement?
I ultimately want to display group details on a page
<li *ngFor="let group of groups| async">
{{ (group.data | async)?.field }}