DEV Community

Discussion on: How to Navigate to Previous Page in Angular

Collapse
 
gagansingh profile image
Gagandeep Singh

hi sir awesome idea, but I have one doubt that will this method stores the previous state like if I have a dropdown with some value selected will it be able to remember the state of dropdown?? I am learning angular so please pardon me if the ques looks silly : )

Collapse
 
n_mehlhorn profile image
Nils Mehlhorn

hey there, that's definitely not a silly question!

Angular will destroy routed components once you navigate away from them by default. So, it won't remember the state of a dropdown. You'll either have to maintain this state outside of the component (in a service) or implement a RouteReuseStrategy