-
-
Save jeffreyvr/fdbd207ba3d9eaf54d7f00fa9d0fc423 to your computer and use it in GitHub Desktop.
Framework7 populate template from rest api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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