Pushing same page recursively with parameters and going back


#1

Hello,

I am developing an application in ionic 2. And i am having a problem with pushing the same page with parameter to one other. The scenario is I have two pages profile page(with userID as the parameter) and list of friends page. From profile page by clicking the button friends i am pushing list of friends page with userId as parameter and then subscribe to all his friends. Then From list of friends we can click on someone i send his userId to profile page to see his profile. Again by clicking friends button in the clicked user profile page you can see list of his friends. When going forward everything works fine.

The problem is when you go backwards all my subscriptions are gone and shows wrong user data.

page flow
Profile => list of friends => profile(clicked user) => list of friends(clicked user)
how to make sure that the data stays the same when they click back button from navbar

Back flow problem
list of friends(clicked user) => profile(clicked user) => list of friends(problem shows empty as parameter is not there to subscribe) => Profile(empty as no userid Parameter to subscribe)

How do i make sure when user clicked back button in navbar the data is subscribe or shown.