in Education by
Is there any option to get two values from one subscription? The first being all profile data and the second is just the favorite data filtering by name. I want to use fewest number of firebase request as I can. the db structure: profile{ uid{ name, age, favorite{ name, uid, } } } this the component code: ngOnInit() { this.db.getDataObj("/Profile/" + this.uid).subscribe(res =>{ console.log("Profile Result"); console.log(res); }); this.db.getDataObj("/Profile/" + this.uid/favorite).subscribe(res =>{ console.log("Profile Result"); console.log(res); }); this the service code: getDataObj(objpath:string){ this.objRef = this.db.object(objpath); this.obj = this.objRef.valueChanges(); return this.obj; } JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
That is not possible. One request will always return one response. However, looking at your database structure you should only need one request. this.db.getDataObj("/Profile/" + this.uid).subscribe(res =>{ console.log("Profile Result"); console.log(res); }); The "res" here should contain the complete profile object (including the "favorite" object). If you still want to make this code shorter/cleaner you can look into creating a "zip" observable. More info here.

Related questions

0 votes
    Is there any option to get two values from one subscription? The first being all profile data and the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    Is there any option to get two values from one subscription? The first being all profile data and the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I want to make a method that will populate the lst_List list with rows from various tables and fields. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I want to make a method that will populate the lst_List list with rows from various tables and fields. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    As the title says, why does my html template look different on three different screen sizes? I understand ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I have a split screen design. I'd like to access the folder ID from the parent route only when ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 30, 2022 in Education by JackTerrance
0 votes
    10 mangoes are to be distributed among 5 persons. The probability that at least one of them will receive none, is A ... 143 D. 125 143 Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
0 votes
    Kafka supports both 'queuing model' and 'publish-subscribe' model? (1)False (2)True...
asked Jun 16, 2021 in Technology by JackTerrance
0 votes
    A circuit consists of an excitation voltage VS, a resistor network and a resistor R. For different values of R, ... GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    which excel function is used to combine conrents from different cells into one cell? 1. concatenate() 2. consol() 3. void() 4.main() Select the correct answer from above options...
asked Dec 14, 2021 in Education by JackTerrance
0 votes
    I need to implement a real-time notification functionality in a web application from an AWS lambda function. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    The simplest way of transferring control is for the old primary to receive __________ from the old backup site ... Systems topic in division Recovery System of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    ________ is utilized to receive data that is not present in a particular Process Group from the processor. (1)Output Port (2)None of the options (3)All the options (4)Input Port...
asked Apr 18, 2021 in Technology by JackTerrance
...