避免销毁页面并避免再次触发ngoninit Angular Ionic
我有2页A页和第B页,我再次使用两次。
示例我的路线:
Page A -> Page B -> Page A (second) -> Page B (second)
或在真实应用中实现:
posting -> profile -> another posting -> another profile
The problem:
当从第B(第二)到A页(第二)向后导航时,没有问题。但是,当再次导航到B页面时,第B页再次触发ngoninit,当我检查该页面上的变量时,它是空的。因此,我得出结论,B被摧毁了。
问题:
如何避免销毁?我想要从第A页(第二页)导航到B页面时,没有更改,显示B条件与我之前打开的情况相同。
*信息:每个URL已经使用不同的参数
I have 2 pages, Page A and Page B, that i use again twice.
Example my route:
Page A -> Page B -> Page A (second) -> Page B (second)
Or implemented in real app:
posting -> profile -> another posting -> another profile
The problem:
When navigate backward from Page B (second) to Page A (second) there is no problem. But, when navigate back again to Page B, Page B trigger NgOnInit again and when i check the variables on that page, it is empty. So, i conclude Page B was destroyed.
Question:
How to avoid destroy? i want when navigate back from Page A (second) to Page B, there is no changed, showing the page B condition that same like i opened before.
*info : Every url already use different parameter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用了离子路线(离子切除术),并同意导航在离子中正常工作。我的错误是当导航时,我使用了Angular Library的Location.Back(),没有使用Ionic的Defaulthref
I used ionic route (IonicRouteStrategy) and agree that navigation work fine in ionic. My mistake is when navigate back, i used location.back() from angular library, didn't use defaultHref from ionic