Dear all,
Can anyone please help on how to use app.request.json/ajax call in app root and get the data in component as per below via app.data? In have seen the examples with static data and tried it, it works. Though I can’t get to use a ajax call.
Thank you all in advance.
In app root:
var app = new Framework7({
name: ‘avo’,
id: ‘io.framework7.testapp’,
root: ‘#app’,
theme: theme,
data: function () {
return {
cards:[],
};
},
ready:function(){
this.getCards();
},
methods: {
getCards: function(){
app.request.json(‘http://localhost:8080/avo/carditemlist’).success(function(reponse) {
this.cards = response.data;
});
},
},
routes: routes,
});
In component