- // Scroll up
- this.scrollUpSub = scrollObservable
- .pipe(
- // Check we scroll up
- filter(({ current }) => {
- const res = this.lastCurrentTop > current
-
- this.lastCurrentTop = current
- return res
- }),
- filter(({ current, maximumScroll }) => {
- return current !== 0 && (1 - (current / maximumScroll)) > this.decimalLimit
- })
- )
- .subscribe(() => this.nearOfTop.emit())
-
- // Page change
- this.pageChangeSub = scrollObservable
- .pipe(
- distinct(),
- map(({ current }) => this.calculateCurrentPage(current)),
- distinctUntilChanged()
- )
- .subscribe(res => this.pageChanged.emit(res))
+ if (this.dataObservable) {
+ this.dataObservable
+ .pipe(filter(d => d.length !== 0))
+ .subscribe(() => this.checkScroll = true)
+ }