mercredi 1 avril 2015

ember add an promise to a rsvp promise because of action

i have a route that returns several models as such



FriendEnemyRouter

model: function() {
return Ember.RSVP.hash({
friends: this.store.find('People', ...),
enemies: this.store.find('People', ..),


On the same router theres an action (Its on the router because it does store 'things')



actions: {
findMoreFriends: function(param, param) {
var newFriends = this.store.find('People', ..);
var newPromise = this.controller.get('model'); //OK. Inspecting sees above friends and enemies. What type is it?

model.set("newFriends": newPromise); // throws an exception
//-- or --
model.newFriends = newPromise; // no exception but observer (computer property) on the controller is not fired.
}
}


Ultimately i wish this computed property on the controller to fire



FriendEnemyController

computedNewFriends: function() {
....
).property('newFriends');


What is the procedure for adding new promises to rsvp promises...not even sure the object types...



model.set("newFriends": newPromise); // throws an exception
model.newFriends = newPromise; // no exception but observer (computer property) on the controller is not fired.




Aucun commentaire:

Enregistrer un commentaire