Skip to content

Instantly share code, notes, and snippets.

@samuraisam
Created May 9, 2014 20:25
Show Gist options
  • Save samuraisam/621de62c470ad3a1984e to your computer and use it in GitHub Desktop.
Save samuraisam/621de62c470ad3a1984e to your computer and use it in GitHub Desktop.
var MyRoute = Ember.Route.extend({
model: function() {
// this will resolve
return Ember.$.ajax().then(function(data) {
// then this will resolve
return Ember.RSVP.Promise.all([
Ember.$.ajax({url: data.item1url}),
Ember.$.ajax({url: data.item2url})
]).then(function(items) {
// and this will be your model in the controller
return {
data: data,
items: items
}
});
})
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment