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.
getting last generated page from pushPage
Nickster last edited by
I need to target a div from inside the newest (or top) page template after pushPage method is fired.
Is there an easy way to do this?
I’m basically reusing the template for each page (after the inital page), and using php to load the html dynamically for the content of the template. The problem is, they all have the same ID’s.
Is there a way after pushPage generates the new navigator page, to increment the id by one so they’re unique?
emccorson administrators last edited by
Sorry, I’m not really sure what you’re asking.
You can get the new page when pushPage is run from the postpush event https://onsen.io/v2/api/js/ons-navigator.html#event-postpush
jamal last edited by
@nickster, try creating a global var for example: gPageID, then increment it as you push pages.
Something use like:
'<ons-page id="' + gPageID + '" >
If you are stuck, post your code to CodePen.