Skip to content

Commit

Permalink
fixed scrollUp after first scrolldown
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael.guardeno committed Sep 16, 2020
1 parent ded59e1 commit c43e3d8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ export class AppComponent {

pageNo = Math.max(0, pageNo);

console.log({pageNo});


setTimeout(() => {
this.imageService
.getAllImagesPagination(pageNo, pageSize, sortBy)
Expand All @@ -81,12 +84,16 @@ export class AppComponent {
}

onScroll() {
console.log("Scrolled Down");

this.scrolledDownCounter++;
this.getALLImagesPagination(this.pageNo + 1, this.pageSize);
}

onScrollUp() {
if (this.pageNo !== 0) {
console.log("Scrolled Up");

if (this.pageNo > 1) {
this.scrolledUp = true;
this.getALLImagesPagination(this.pageNo - 1, this.pageSize, null, true);
}
Expand Down

0 comments on commit c43e3d8

Please sign in to comment.