I have a component that contains sub components and can potentially be nested inside itself. I seem to be having a problem where the variable ‘panes’ appears to be static between all components when i would assume it would be an instance member.
For instance here is a sample of my code, when this runs the panes contains 4 elements instead of 2 and then 2. Why?
{{#splitter}}
{{#pane}} content {{/pane}}
{{#pane}}
{{#splitter}}
{{pane}}
{{pane}}
{{/splitter}}
{{/pane}}
{{/splitter}
pane code:
export default Ember.Component.extend({
addPaneToParent: function()
{
var parent = this.get('parentView');
if(parent.registerChildPane)
{
parent.registerChildPane(this);
}
}.on('init'),
});
splitter code:
export default Ember.Component.extend({
panes: [],
didInsertElement: function() {
var panes = this.get('panes');
}
registerChildPane: function(pane) {
console.log(this.get('elementId') + ' ' + pane.get('elementId'));
this.get('panes').addObject(pane);
}
});