jeudi 1 décembre 2016

aggregate several computations into one in Ember.computed

Let us assume, I have several computed properties in my Controller which alters the model:

  _parents: Ember.computed.mapBy('model', 'parent'),
  _parentUniq: Ember.computed.uniq('_parents'),
  parents: Ember.computed.map('_parentUniq', (rawParent)=> {
return `\parent\${rawParent}`
  }),
  sortedParents:Ember.computed('parents',function(){
    return this.get('parents').sort();
  }),

In my template I use only sortedParents. Can I chain Ember.computed somehow?




Aucun commentaire:

Enregistrer un commentaire