I have model
import DS from 'ember-data';
export default DS.Model.extend({
Structure: DS.attr('raw'),
});
So, structure is array of objects
[{
type: 'comp-a',
children: [
{type: 'comp-b'},
{type: 'comp-b'}
]
}]
Next, i print this structure
structure: Ember.computed('model.Structure', function() {
var st = this.get('model.Structure');
// handle this structure
return st;
});
{{#each structure as |item|}}
{{component item.type}}
{{/each}}
Question.
When I push object to comp-a
, Ember renders new pushed component
this.get('model.Structure')[0].children.pushObject({
type: 'comp-b'
});
But, when I remove any object it doesn’t.
var child = this.get('model.Structure')[0].children[0];
this.get('model.Structure')[0].children.removeObject(child);