Shows an implementation of simple paging (Next and Previous) with Angulare 2 and Firebase.
Each entry requires a priority
field that will allow for sorting the data descending.
entry.priority = 0 - Date.now();
The paging happens in pager.component.ts
and the data is emitted to your component. See the below files for example.
The pager queries an extra entry from Firebase itemsPerPage + 1
and makes use of this entry for the startAt
and endAt
options.
When next is pressed, the extra entry is used for the startAt
option.
When previous is pressed the extra entry is used for the endAt
option.
Keeping the extra entry allows for simple next and previous paging.
See pager.components.ts
for details.