mardi 11 avril 2017

Setting a computed property that is an array

Is a way to set a computed property that returns an array? In the following example the get function gets called but never the set function when new participants ids are added/removed

participantIds: computed({
    get() {
        Ember.debug('Getting...');
        return this.get('participants').mapBy('id');
    },
    set(key, participantIds) {
        Ember.debug('Setting...');
        // do something when participants ids changed
        return participantIds;
    }
}),




Aucun commentaire:

Enregistrer un commentaire