AKSHAY SALEKAR
AKSHAY SALEKAR

Reputation: 86

State management in angular

So I am stuck in state management in angular. lets say I have real estate web app user searches keywords and then applies few filters and then clicks on one result. Now when he presses back I want to give him back all the keywords, filters along with results as it is . I want to know which method and practices is best to achieve this. I have read about ngrx, rxjs. But I am bit confused in how to manage it on back press and all other stuff. I have used rxjs in state management and able to achieve it, but i don't think that was good way to do it.I want better way to do it

Upvotes: 0

Views: 119

Answers (2)

Subbu
Subbu

Reputation: 618

What you are talking about is the client state where you typically save filter options and UI states like if an accordion should be expanded or closed. Also your URL should reflect the filter options, meaning the URL should contain the filer options and their values. This way when user goes back the user is automatically taken to the page that shows the results for the same filter options applied before. This is true for any technology and not just angular.

Upvotes: 1

BELLIL
BELLIL

Reputation: 765

filters are not linked to the application state, i think the easier way is either to save them in the database, or in sessionstorage.

Upvotes: 0

Related Questions