Let’s assume multiple pages with the same type of elements.
Using IDs everywhere would be overkill and, as multiple pages (2, if I remember properly) are still preserved in DOM, there would be a element conflict, in example, multiple "<input class='username'>" stored in two different pages.
page.$el.find(“something”)
isn’t always available, in example, I don’t have “page” without using
app.on('pageInit', function(page) {
}
So, how can I access the current active page, without using tons of selectors every time ?
What I would like to avoid is to prefix everything with the current page selector (ie “.page[data-name=“login”]” or “.page-current”)
Sorry for this silly questions but i’m really new to this awesome framework. The ability to use plain javascript without Angular, TypeScript or so, it’s gorgeous
How safe is to rely on .page-current selector inside the page:init event ?
If I understood properly, page:init will trigger when a page is shown, thus, .page-current should always bound to the page triggering the page:init event, right ?
Asking this because app.views.main.router.currentPageEl is undefined but app.views.main.router is set as the router instance.
In my project it doesn’t work.
Anyway, it simply return the element based on .page-current class, thus my question here Access to element inside page is still valid