orderby firebase angular

Solutions on MaxInterview for orderby firebase angular by the best coders in the world

showing results for - "orderby firebase angular"
Sara
01 Apr 2018
1import { map, take } from 'rxjs/operators';
2import { Observable } from 'rxjs';
3
4public allProducts: Observable<any[]>;
5 public amazonCollection: AngularFirestoreCollection;  
6
7this.amazonCollection = this.afs.collection('amazon', (ref) =>
8      ref.orderBy('voteCount')
9    );
10    this.allProducts = this.amazonCollection.snapshotChanges().pipe(
11      map((actions) => {
12        return actions.map((a) => {
13          return { id: a.payload.doc.id, ...a.payload.doc.data() };
14        });
15      })
16    );