This is my firestore document . I want to get the list of comments to an observable, subscribe to that and iterate through the comments. How to do that using angular fire ? I am a beginner here so I would be much thankful to you if you could explain this in detail
Thank you !
On your component.ts file
doc: issue;
doc_comments: Array<string>;
ngOnInit() {
db.collection('Agriculture_and_cropes').doc<issue>('doc_Id').valueChanges().subscribe(data => {
this.doc = data;
this.doc_comments = Array.from( data.comments.keys() );
});
}
On your component.html
<ul *ngIf="doc_comments">
<li *ngFor="let c of doc_comments">
{{c}} : {{doc.comments[c]}}
</li>
</ul>