Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Last active May 26, 2018 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/7a8b427ba448343ce718e5f1f1793689 to your computer and use it in GitHub Desktop.
Save uno-de-piera/7a8b427ba448343ce718e5f1f1793689 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import {AngularFirestore, DocumentChangeAction} from 'angularfire2/firestore';
@Injectable({
providedIn: 'root'
})
export class AfireService {
constructor(
private afs: AngularFirestore,
) {}
paginate (limit: number, last: string): Observable<DocumentChangeAction<any>[]> {
return this.afs.collection('todos', (ref) => (
ref
.where('id', '<', last)
.orderBy('id', 'desc')
.limit(limit)
)).snapshotChanges();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment