Consider the scenario where I have two distinct Angular 2 components known as ComponentA
and ComponentB
. My goal is to navigate from ComponentA to ComponentB and then return to ComponentA without needing to reinitialize it.
In the current setup of Angular 2 Router, whenever I move away from a component, that particular component undergoes destruction and needs to be created again once I revisit it.
I am aware that one way to maintain the state of components is by leveraging a Service, but this approach appears to be more like a temporary fix instead of a permanent solution. Are there any alternatives to this dilemma?