Created
May 9, 2014 20:25
-
-
Save samuraisam/621de62c470ad3a1984e to your computer and use it in GitHub Desktop.
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
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