Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
ons-navigator data not showing properly for muliple pages
-
I have used ons-navigator and created 3 pages this is my codepen and passing data to 2nd and third page but when I press back button from 3rd page it shows data of 3rd page not second page and again I press back from 2nd page it shows correct data and then goes to 1’st page
-
@Gaurav
navigator.topPage
is a pointer to the last page, so when you push or pop pages this pointer changes. Therefore, your page-2’s title changes when you push page-3 and somehow Angular doesn’t refresh the view when you pop back to page-2.In any case, you want to avoid so many updates, and an easy way to do it is to stop depending on
topPage
pointer:<ons-page ng-init="data = componentnNavigator.topPage.data">
, and then access this new object:{{ data.title }}
. It can also be done in a page’s controller but I guessng-init
is quite handy.
-
Thanks Fran this worked for me :grinning: