Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _get_brands_(cursor, direction) {
- if ( direction === 'next') {
- if ( cursor === 0) {
- this.brands_collection = this.afs.collection('brands', ref =>
- ref.orderBy('created')
- .limit(5)
- );
- return this.brands = this.brands_collection.valueChanges();
- } else {
- this.brands_collection = this.afs.collection('brands', ref =>
- ref.orderBy('created')
- .startAfter(cursor)
- .limit(5)
- );
- return this.brands = this.brands_collection.valueChanges();
- }
- } else if (direction === 'back') {
- console.log('Back pagination start ==> ', cursor);
- this.brands_collection = this.afs.collection('brands', ref =>
- ref.orderBy('created')
- .endBefore(cursor)
- .limit(5)
- );
- return this.brands = this.brands_collection.valueChanges();
- }
- }
Add Comment
Please, Sign In to add comment