diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts index d2cf53227..dc212788a 100644 --- a/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts +++ b/client/src/app/shared/shared-main/angular/infinite-scroller.directive.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import { fromEvent, Observable, Subscription } from 'rxjs' | 1 | import { fromEvent, Observable, Subscription } from 'rxjs' |
2 | import { distinctUntilChanged, filter, map, share, startWith, throttleTime } from 'rxjs/operators' | 2 | import { distinctUntilChanged, filter, map, share, startWith, throttleTime } from 'rxjs/operators' |
3 | import { AfterContentChecked, Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core' | 3 | import { AfterViewChecked, Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core' |
4 | 4 | ||
5 | @Directive({ | 5 | @Directive({ |
6 | selector: '[myInfiniteScroller]' | 6 | selector: '[myInfiniteScroller]' |
7 | }) | 7 | }) |
8 | export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterContentChecked { | 8 | export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterViewChecked { |
9 | @Input() percentLimit = 70 | 9 | @Input() percentLimit = 70 |
10 | @Input() autoInit = false | 10 | @Input() autoInit = false |
11 | @Input() onItself = false | 11 | @Input() onItself = false |
@@ -24,13 +24,14 @@ export class InfiniteScrollerDirective implements OnInit, OnDestroy, AfterConten | |||
24 | this.decimalLimit = this.percentLimit / 100 | 24 | this.decimalLimit = this.percentLimit / 100 |
25 | } | 25 | } |
26 | 26 | ||
27 | ngAfterContentChecked () { | 27 | ngAfterViewChecked () { |
28 | if (this.checkScroll) { | 28 | if (this.checkScroll) { |
29 | this.checkScroll = false | 29 | this.checkScroll = false |
30 | 30 | ||
31 | console.log('Checking if the initial state has a scroll.') | 31 | // Wait HTML update |
32 | 32 | setTimeout(() => { | |
33 | if (this.hasScroll() === false) this.nearOfBottom.emit() | 33 | if (this.hasScroll() === false) this.nearOfBottom.emit() |
34 | }) | ||
34 | } | 35 | } |
35 | } | 36 | } |
36 | 37 | ||