I'm trying to understand a way to assign this context to a promise without using bind.
If I have the following promise
Ember.RSVP.Promise.all([
//THIS REFERS TO AN EMBER OBJECT
this.store.find('product', this.productSpecifications(null,null,"TRP")),
this.store.find('product', this.productSpecifications(null,null,"TRF")),
]).then(function (values){
this.set('recommendedPaid', values[0]);
this.set('recommendedFree', values[1]);
}.call(this)).catch(function(err){
console.log('error found in recommended products');
});
When I do call(this) to the callback function, I can access the js object but the response "values" are lost.
How can set context to Ember Object with this and pass the promise response
Aucun commentaire:
Enregistrer un commentaire