1.346 / 5.000
Hello, I come from the backend world and I am creating a component using Angular 18 that shows a list of clients and one of the characteristics of this component is that it must save in the localstorage the state of the applied filters and the number of the page in which it is located so that when the user goes to another page and returns to the list of clients it shows the information according to the last state saved in the localstorage. My problem is that when I select a page in the pagination and I go to another page when I return to the list the pagination returns to 1 and I can't find exactly the reason. I have followed up and apparently when initializing the component it loads the data from the localstorage but then they return to 1 but I can't find the function that makes it return to 1. I have created a service to bring the data and save it in the localstorage I would like to find the reason for this behavior. I've been thinking about putting the loading logic in the constructor but I think it's better to keep it in the NgOnInit end, maybe my approach to storing the page state is not the most optimal and I'd like to know if there could be another more efficient approach.
I appreciate any help you can give me, thank you very much