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?
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.