Get new loaded page title


First off, congratulations on V5, I like it a lot.

I am trying to set up a process to get a new page’s title.

I can react to the change, but I can’t get the new title, I get either the previous (index.html) page’s title, or one of the side bars.

app.views.main.router.on('routeChange', function(){
  console.log(' - Page changed');
  console.log('----->>>>' + $$('.page-current').attr('data-name'));
  app.views.main.router.on('pageMounted', function(){
    console.log(' - Page mounted');
    console.log('----->>>>' + $$('.page-current').attr('data-name'));
    console.log('----->>>>' + $$('.title').html());

  - Page changed
 - Page mounted
----->>>>Left Panel

Any ideas?

Thank you very much.
Params: newRoute, previousRoute, router

Thank you!

I found out that I can not get the new page’s title because there are several divs with that class, I will use ids for them.


app.views.main.router.on('routeChanged', function(newRoute, previousRoute, router){

  console.log('newRoute ' + JSON.stringify(newRoute));
  console.log('previousRoute' + JSON.stringify(previousRoute));


newRoute {"query":{},"params":{},"url":"/about/","path":"/about/","route":{"path":"/about/","url":"./pages/about.html"}} 


For some reason the index.html is seen as 404.html, when I go back or leave that page that is the route I get. But I get the path ‘ls’ which is the base path, so I can figure out the rest I guess.

Again, thank you so much.

Apparently route with /ls/ path must be specified in routes as well


I see what was going on.

Thank you so much, this is basically what I needed.

Best regards.