vendredi 4 mai 2018

Ember extend component computed property?

I have a parent component Parent and Child component that extends Parent. In Parent there is a computed property items that returns array. Is there a way to have items in Child component that will return both elements from parent array and additional elements e.g.

Parent:

Ember.Component.extend({
  items: computed(function() {
    return ['a', 'b'];
  })
})

Child:

Parent.extend({
  items: computed(function() {
    // I want to add some more elements to parent property
    // so this should return ['a', 'b', 'c', 'd']
    return this.get('items').concat(['c', 'd']);
  })
});

Currently I get Maximum call stack size exceeded.




Aucun commentaire:

Enregistrer un commentaire