0

I use Observable to get single object data from the firebase. How do I render this data on HTML? I use this {{(postObservable2|async)?.subject}} but nothing is rendered.
I tried to use AngularFireObject as well but it keeps throwing an error saying that

firebase datasnapshot type cant assign to the AngularFireObject.


"angularfire2": "^5.0.0-rc.4"

 this.postObservable = this.firebase.object(`allPosts/${this.postID}`).snapshotChanges();
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
NicoleZ
  • 1,485
  • 3
  • 22
  • 43

1 Answers1

1

Try subscribing to the observable this way:

let yourArray = [];
this.postObservable.subscribe(res => {
  res.map(c => {
    yourArray.push(c);
  })
})
console.log(yourArray);

Then in the template use yourArray as ngFor iteratable.

Sergey Rudenko
  • 8,809
  • 2
  • 24
  • 51