When I use this form below I do not have any issue passing the context to the next router…
app.router.navigate('/search/', {
reloadCurrent: false,
pushState: false,
context: {
search: {
origin: _origin,
destination: _destination
},
}
});
but when I am in the component page and I need to update the value of the app.data or context sent previously but this does not work…
search component page code:
…
pageInit: function(e, page) {
console.log(‘pageInit’, page);
console.log(this.search);
origin = this.search.origin;
destination = this.search.destination;
app.request({
url: "assets/_g.request.php",
dataType: "json",
method: "POST",
data: { re: 'f'},
success: function(response) {
console.log(response);
app.data.response = response;
}
});
I tried to put this inside data function but it does not work either…
data: function () {
…
app.request({
url: "assets/_g.request.php",
dataType: "json",
method: "POST",
data: { re: 'search'},
success: function(response) {
console.log(response);
return {
response: response,
}
}
});
Any ideas how to update data inside the template in Pageinit or data function using app.request?