While fetching data, I have added a loading feature. My view list includes pagination and page size. The issue arises when I change the page size and move to other pages immediately after loading, as it does not scroll back to the top. I have tried adding
this.document.body.scrollTop = 0;
after loading, but it does not solve the problem.
Below is the code snippet for fetching data:
`getProducts() {
this.productService
.getProducts(this.args)
.subscribe(
data => {
this.data = data;
this.loadingService.hide();
this.document.body.scrollTop = 0;
},
(error) =>
console.log(error);
}
);
}`