Skip to content Skip to sidebar Skip to footer

Is There A Way To Set An Observer On Any Ember Model Change In Ember Store?

First of all, I am using ember 2. I am requesting the back-end and it returns some data. Then, I pushed these data to a model in ember store. The issue that I want to do some actio

Solution 1:

findAll returns live array, so we can have dependent key for the findAll result so that our observer/computed properties will be triggered every time stores model changes.

userModel:Ember.computed(function() {
    returnthis.get('store').findAll('user');
  }),

 userModelObserver: Ember.observer('userModel.[]',function(){
    console.log('observer triggered');
  }),

May be this is not the ideal solution.

Post a Comment for "Is There A Way To Set An Observer On Any Ember Model Change In Ember Store?"