From e19067c9bbac3c3bb450c80f73eb5518bd0db1a1 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Wed, 30 Oct 2013 14:51:02 -0700 Subject: fix(ngIf): ngIf removes elements dynamically added to it When using ngIf with ngInclude on the same element, ngIf previously did not remove elements added by ngInclude. Similarly, when using ngIfStart/End, ngIf will miss elements added between the start/end markers added after ngIf is linked. This commit changes the behavior of ngIf to add a comment node at the end of its elements such that elements between the starting comment and this ending comment are removed when ngIf's predicate does not hold. --- src/ng/compile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ng/compile.js') diff --git a/src/ng/compile.js b/src/ng/compile.js index 7754a8e6..af7d5e6b 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1175,7 +1175,7 @@ function $CompileProvider($provide) { if (directiveValue = directive.transclude) { // Special case ngRepeat so that we don't complain about duplicate transclusion, ngRepeat // knows how to handle this on its own. - if (directiveName !== 'ngRepeat') { + if (directiveName !== 'ngRepeat' && directiveName !== 'ngIf') { assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode); transcludeDirective = directive; } -- cgit v1.2.3