When I do something like:
Ember.$.getJSON(url)
.then(function(response){
return Ember.RSVP.all(response.map(Ember.$.getJSON))
})
.then(function(response){
// this is where the oddity begins
console.log(response)
})
in the model
hook in my application router on my local environment (Ember 1.13.5), I get a weird response, in the second then()
's response, like:
Promise: {
_id: 48
_label: undefined
_result: Array[1]
_state: 1
_subscribers: Array[0]
__proto__: Promise
}
I can do a response.then()
in the second then
to get the response I'm looking for, but that is less than ideal since I would like to chain promises.
I tried to set up the same example on JSBin, using Ember.run.later
to act as promises: JSBin Example. The methodology seems to work fine here.
Am I missing something?
Aucun commentaire:
Enregistrer un commentaire