diff --git a/lib/meteorFamousView.js b/lib/meteorFamousView.js index 645106c..605db48 100644 --- a/lib/meteorFamousView.js +++ b/lib/meteorFamousView.js @@ -41,10 +41,16 @@ MeteorFamousView.prototype.destroy = function(isTemplateDestroy) { log.debug("Destroy (start) of " + this.type + " (#" + this.id + ") from " + this._source + ": children, components"); // TODO, tests - _.each(this.children, function(child) { + for (var i = this.children.length - 1; i >= 0; i--) { + Blaze.remove(this.children[i].blazeView); + }; + + /* This is deistroying only odd number of node like if I have 5 children(1-5) node then its only remove 1,3,5 children because of array postion auto adjust after every node delete*/ + // _.each(this.children, function(child) { //child.destroy(); - Blaze.remove(child.blazeView); - }); + // Blaze.remove(child.blazeView); + // }); + // components // TODO, tests