Home > Mobile >  Page does not change when navigating forward from second page to third page, which is the first page
Page does not change when navigating forward from second page to third page, which is the first page

Time:06-10

Example, my route way is like this : page A (first) -> page B -> page A (second)

Routing from page A (first) to B works fine. But, when routing page B to A (second), the page is showing the same condition as page A (first).

I thought angular reuses page A (second) with page A (first). How to make the router to create new page for page A (second)?

*using RouteReuseStrategy or not, it still didn't work

CodePudding user response:

if the objective is to recreate Page A by navigating to it again you can kill the previous route when navigating to Page B.

this.router.navigate(["pageb"], {replaceUrl:true});

if you want to keep several different page A you will need to use a parameter along your route

{path: 'pagea/:param', component: Pagea }
  • Related