I have 2 pages Page1 and Page2
. I have used this.nav.pop()
in Page2 and it will pop the Page2 and Page1 will enable but i want to refresh the Page1.
Thank you in advance.
相关问题
- Angular RxJS mergeMap types
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
In some situations instead of pop() you can use the push() function. When you enter the page with the push() function it is reloaded. Also you can remove page2 from the navigation.
Or if you have more than one page for example page1->page2->pag3:
you could pass the parent page along with the nav push. that way you could accces the parent page as a navParamter.
in parent page:
and in the child page before pop you could call functions on parent page
ionViewWillEnter will be called just before any time you (re)visualize the page
You may consider send an event before call
this.nav.pop
to let page 1 reload itself.You may want to implement one of these in your page:
ionViewWillEnter ionViewDidEnter
Please review the navController and page lifecycle documentation: http://ionicframework.com/docs/v2/api/components/nav/NavController/
I had the same problem and spend many hours searching and trying the solution.
If I understand, your problem is:
Page 1 have some bindings that you get from an API / Webservice.
Page 2 have some inputs and when pushing the back button (pop) you want to SAVE data + refresh the Page 1 bindings.
The way I solved it has been reading a post on StackOverflow that now I can't find :( !!
The solution is using an Injectable Service.
PAGE 1:
INJECTABLE SERVICE:
PAGE 2:
I hope it can help you!! Ask for any similar problems :)