Firestore + AngularFire2 pagination ( query items by range - .startAfter(lastVisible) )
In a component I want to pull a range of items from FireStore, for ex. from 0 to 5, from 5 to 10 etc. I found this in FireStore's docs, but they dont use AngularFire2 so as harder I tried to refactor as bigger mess I got. I made it working by simply splice() 'ing: service -> topFirstScores(): AngularFirestoreCollection<Score> { return this.fireRef.collection('scores', r => r .orderBy('score', 'desc').limit(6) ); } component -> $scores = new Subject(); this.scores$ = this.$scores.asObservable(); if (this.scores === 'first') { this.scoreS.topFirstScores().valueChanges().take(1) .subscribe(_ =>