简体   繁体   English

从第二页向前导航到第三页时页面不会改变,第三页是与第三页具有相同 url 的第一页 Angular Ionic

[英]Page does not change when navigating forward from second page to third page, which is the first page with the same url as the third page Angular Ionic

Example, my route way is like this : page A (first) -> page B -> page A (second)例如,我的路由方式是这样的:page A(第一)-> page B-> page A(第二)

Routing from page A (first) to B works fine.从页面 A(第一个)到 B 的路由工作正常。 But, when routing page B to A (second), the page is showing the same condition as page A (first).但是,当将页面 B 路由到 A(第二个)时,该页面显示的情况与页面 A(第一个)相同。

I thought angular reuses page A (second) with page A (first).我认为 Angular 将页面 A(第二个)与页面 A(第一)重用。 How to make the router to create new page for page A (second)?如何使路由器为页面A(第二个)创建新页面?

*using RouteReuseStrategy or not, it still didn't work * 使用RouteReuseStrategy还是不行

if the objective is to recreate Page A by navigating to it again you can kill the previous route when navigating to Page B.如果目标是通过再次导航到页面 A 来重新创建页面 A,您可以在导航到页面 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如果你想保留几个不同的页面 A,你需要在你的路线上使用一个参数

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM