Back event not work in V2


#1

I want to use back event on V2 like V1

like

$$(document).on('page:back', function (e) {
    console.log(e);
});

#2

There is no such event in v2, you can probably use “page:beforeout” and check the direction (from/to properties) in event.detail


#3

It work, thank you sir.


#4

Are you have know other events about page switch in V2? Share me please.


#5

#6

Hi, I have a view with several fields I want to update my database once I leave the page.
I’m using page:beforeout on this view to update my database.
The problem is that the fields are null.

$$("#travel_detail_name_day").val();

any ideas?


#7

Whats type it’t element ('#travel_detail_name_day') ?

Please, send you html file.


#8
<input type="text" placeholder="Título" id="travel_detail_name_day" class="">

this my html element


#9

Try it add it in your router.js

pageAfterOut: function () {
           var valor = $$("#travel_detail_name_day").val();
           console.log(valor);
}

Sorry for my enligsh horrible. rsrs

More infos: https://blog.framework7.io/mastering-v2-router-958ea2dbd24f


#10

Hi, thanks for the response. I will try it.


#11

Ok, I right… look ‘tis:

pageAfterOut: function (e,page) {
           console.log(page);
}

#12

It worked with event call inside the router file


#13

Poste example. Very Good! Nice job.