I'm looking to figure out how to retrieve lists from cloud firestore.
Here is how I upload a list :
export interface Data {
name: string;
address: string;
address2: string;
pscode: string;
ccode: string;
name2: string;
}
constructor(private afs: AngularFirestore){
this.notesCollection = this.afs.collection(`imones`, (ref) => ref.orderBy('time', 'desc').limit(5));
}
notesCollection: AngularFirestoreCollection<Data>;
//creating item in list (imones)
createItem(){
this.notesCollection.add(this.busines);
}
Now, the question arises on how to fetch all the items from that list?
This is my attempt :
constructor(private afs: AngularFirestore){
this.items = this.notesCollection.valueChanges();
}
items: Observable<Data[]>;
HTML :
<p *ngFor="let item of items">{{item.name}}</p>
Error:
ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
Another error :