I have a requirement where I need to use the same URL for 2 components.
Let's assume that the path is /path and the components are Foo and Bar.
Initially, I will see the Foo component and after pressing a link I will be redirected to the Bar component.
/path (Foo) => /path (Bar)
Now I see the Bar component and if I press the back button from the browser I need to be redirected to the Foo component
/path (Bar) =>back button=>/path (Foo)
And also if I press the "forward" button I need to see the Bar component
/path (Foo) =>forward button=> /path (Bar)
So, basically, I need to have the same URL but somehow keep all the features provided by the Angular router, just as if there were 2 different paths.
Is this possible? I've looked into the NavigationExtras options, like skipLocationChange, or replaceUrl but these options don't help me. Neither does history pushState or replaceState (or maybe I don't know how to make use of them).