Trying to do the following:
- paginate data on browser back button IF user has gone through the pagination itself meaning if
this.currentPage >0
.
Currently what I have tried is
ngOnInit(): void {
this.location.onPopState((event)=>{
if(this.currentPage >0){
window.history.go(0);
event.preventDefault(); //not stoping the event
this.currentPage = this.currentPage -1;
if (this.currentPage * this.pageSize >= this.placements.length - this.pageSize) {
this.loadMorePlacements();
}
this.updatePaginator();
this.updateStorePaginator();
}
});
}
Problem is the event is not stopped and the application is taken to the previous route.
Is there a way to stop the event and just paginate the data? Any help would be appreciated