lundi 19 juin 2017

How does component observer change when the ember service variable changes

I have a service with a variable "players" which is an array. Whenever the service variable changes, i want to compute a variable in another component. I have used observer and computed property but the component observer is not getting called or changed.

**service.js:**
export default Ember.Service.extend({
    players:{},
});


**component.js:**
export default Ember.Component.extend({
   newPlayers:Ember.computed('service.players',function(){
     //code to be executed
  });
});

when the service player changes the newPlayers observer is not getting called.

Please help me in how to get it or the right approach.




Aucun commentaire:

Enregistrer un commentaire