mercredi 1 avril 2015

Ember / pull in data from multiple sources in one route

I am using the latest Ember.js and WP-API for a project. Everything is dandy on most pages, but one I tried to get data from different end-points onto the same page - I became lost. For example, I pull in the page {{title}} and maybe some text for an intro. THEN I want to pull in the "projects" in a list below - but I'm unsure of how to get that into the model / route --- doesn't seem like views are the right direction, and nested routes could switch stuff out / but wouldn't really be in the same "page" / route.


Point me in the right direction? : )


(assume that ic.ajax and Ember etc are all imported CLI style)



var siteUrl = 'http://ift.tt/1Iodiuq';

export default Ember.Route.extend({

model: function() {

var simplePageData = ajax({
url: siteUrl + '/pages/landing',
type: 'GET'
});

console.log(simplePageData);
return simplePageData;
}

});




Aucun commentaire:

Enregistrer un commentaire