jeudi 28 juillet 2016

Ember computed property or observer within a service

I have a service, and declare a property in the service

bucket: []

Later in the service, I add something to bucket.

I'm trying to set up in this same service an Ember computed property or observer to listen/respond to changes in bucket.

Something like:

bucketListener: Ember.computed('bucket', function() {
   //do stuff in response to something being added to or removed from the bucket
}

But I can't get this to work. I've tried a lot of different permutations,using Ember.computed and Ember.observer, but I can never get bucketListener to fire.

I have checks in place and am sure that bucket is getting added to as expected or removed from as expected, but bucketListener still isn't getting called into.

Is there some trick to doing this within a service? Or am I just bungling something more basic?




Aucun commentaire:

Enregistrer un commentaire