mercredi 17 juillet 2019

Different routes same component in Angular 7

I use the same component for different routes but when I navigate between routes of the same component the URL is getting changed but page content is the same.

I used this solution:

constructor(route:ActivatedRoute) {
  route.url.subscribe(val => {
     //Code Here
  });
}

I now have the expected behavior but another problem: Angular does not save the previous URL in the browser history.

If the flow is: A -> B -> C where B and C are the same component, if I click on the back button in the browser, I navigate to A instead of B.

Aucun commentaire:

Enregistrer un commentaire