I'm new to angular and I have a requirement to maintain the state of the search results page(i.e preserve the sort and filter values of the search results grid) when the user navigates to the details page by clicking on a link in search results grid and navigates back to the search page again. I tried using CustomReuseStartegy but I'm facing 2 issues:
It would be great if someone can give insights on how and when to reattach the components using route reuse strategy or a different solution to handle my requirement.
If you need to maintain state between components (pages), you should use a service.
Store the data in the service on from the Search page, and leave the page. When you return to the Search page, retrieve the data from the service.
Also, you can store data in localStorage or sessionStorage if that fits your requirement.
If you are using Angular 1.x click here.
For Angular 2+ click here.