Hi, I was looking at the code behind ngIf and I noticed that it doesn't seem to call $scope.$destroy to clean up the watcher it registers:-
https://github.com/angular/angular.js/blob/2a156c2d7ec825ff184480de9aac4b0d7fbd5275/src/ng/directive/ngIf.js Is there any reason why it does not? Seeing as this a standard directive with a lot of usage, I can only assume that this is intentional. Can someone explain why it works this way? Also, I am a bit puzzled by this code:- if (block) { previousElements = getBlockNodes(block.clone); $animate.leave(previousElements).then(function() { previousElements = null; }); block = null; } If leave is meant to take an element, why is it been (potentially) given an array. I am assuming that getBlockNodes is this function:- function getBlockNodes(nodes) { // TODO(perf): update `nodes` instead of creating a new object? var node = nodes[0]; var endNode = nodes[nodes.length - 1]; var blockNodes; for (var i = 1; node !== endNode && (node = node.nextSibling); i++) { if (blockNodes || nodes[i] !== node) { if (!blockNodes) { blockNodes = jqLite(slice.call(nodes, 0, i)); } blockNodes.push(node); } } return blockNodes || nodes; } Thanks. Kamal. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
