The issue I'm running into is when my scroll bar reaches near the bottom, it makes the call for the next 20 records in the result set, however, it replaces the previous 20 records with the new 20. Am I missing something with infinite scroll? Here is my logic:
// top-rated-movies.component.ts
// ... ... ...
import {TopRatedMoviesService} from '../../services/top-rated-movies.service';
//... ... ...
export class TopRatedMoviesComponent implements OnInit {
topRatedMovies: Object;
pageNum = 1;
constructor(private _topMoviesService: TopRatedMoviesService) { }
ngOnInit(): void {
this._topMoviesService.getPopularMovies().subscribe(data => {
this.topRatedMovies = data;
});
}
onScrollDown() {
this.pageNum++;
this._topMoviesService.getPopularMovies(this.pageNum)
.subscribe(data => this.topRatedMovies = data);
}
}