Get nested data from firebase

I have a Firebase database and the data looks like this:

Firebase Database Structure

I want to get data where the foodObject enters the data along with the topic.

I tried this:

return this.af.database.object(`themes/${id}`)
          .map((items) => {
            return items.menu.map(food => {
              return this.af.database.object(`foods/${food}`);
            });
            // return items;
          })
          .concatAll()
          .subscribe((d) => console.log(d));

So I get this in the console.

FirebaseObjectObservable {_isScalar: false, _ref: W}

Is that what I need is achievable?

Also, is this the right way to save and retrieve data?

I am new to rxjs and angular2. Any lead will help.

Thank,

+4
source share

Source: https://habr.com/ru/post/1650191/


All Articles