here's the code:
loadNextBatch() {
console.log('scrolldown');
this.pageIndex = this.pageIndex + 1;
this.global.getData(`/conditions/latest?start=${this.pageIndex}&length=${this.pageSize}`)
.pipe(take(1)).subscribe(res => {
const newBatch = res['data'];
if (newBatch.length === 0) {
return false;
}
this.tempThermometer.next(this.tempThermometer.getValue().concat(newBatch));
console.log(this.tempThermometer);
});
}
what I'm trying to do here is when there's no data from the /conditions/latest?start=9&length=4
it still running to start=11 ...etc
how to make it stop.
when there's no data it should be stop in start=8
because on start=9
there's no data anymore.
How to stop it from the start=8
but when there's a data on start=9
it can be load. but if there's no data on start=9
it shouldn't be loaded.
also the problem when I scroll down it continued to start=11``
start=12it should be stop on
start=8cause there's no data on
start=9```