{
path: '/articulo/:articleId/',
async: function (routeTo, routeFrom, resolve, reject) {
// Router instance
var router = this;
// App instance
var app = router.app;
// Show Preloader
app.preloader.show();
// User ID from request
var id = routeTo.params.articleId;
app.request.get('http://mydomain.com?id=' + id, function (res) {
app.preloader.hide();
// Resolve route to load page
resolve(
{
componentUrl: './pages/articulo.html',
},
{
context: {
data: res,
}
}
);
});
},
},
All is working fine while testing in browser. But when I use phonegap build, after uploading my app and installing it in an Android device this functionality doesn’t work. When I click a related link I can see the preloader, but then the app get locked.
Why it works in browser but not in a device? What can I do in order to see whats going on?
Ok, so if the preloader its shown, it menas that f7 async route yts working fine.
you have this line nof code,
// Show Preloader
app.preloader.show();
and then AFTER the app.request.get you hide the preloader. Wich you say its never trigger
app.preloader.hide();
so my guess, with the code you shared, is that the problem is in the ajax call, no the router.
app.request.get(url, data, success, error, dataType)- Load data from the server using a HTTP GET request
url - string - Request url
data - object - A plain object or string that is sent to the server with the request. Optional
success - function (data, status, xhr) - A callback function that is executed if the request succeeds. Optional
error - function (xhr, status) - A callback function that is executed if the request fails. Optional
dataType - string - The type of data that you’re expecting back from the server. Could be text or json. Optional
so can you make a callback for error, and alert the result, maybe it gives you a hint of what is happening.
I guess the URL is blocked in android. Check whitelist config, cross-domain setting on server, or check if DNS from a browser on android device can resolve this URL. It’s not an error of F7.