Skip to content

Instantly share code, notes, and snippets.

@jeffreyvr
Last active Dec 10, 2019
Embed
What would you like to do?
Framework7 populate template from rest api
routes = [
{
path: '/items/',
async: function (routeTo, routeFrom, resolve, reject) {
app.preloader.show();
app.request({
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'authorization', localStorage.getItem('baseAuthentication') );
},
url: apiurl + '/posts/',
dataType: 'json',
method: "GET",
crossDomain: true,
success: function(response) {
resolve(
{
componentUrl: './pages/items.html',
},
{
context: {
items: response,
},
}
);
app.preloader.hide();
}
});
}
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment