aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng
diff options
context:
space:
mode:
authorTobias Bosch2013-11-11 15:54:24 -0800
committerTobias Bosch2013-11-11 17:05:43 -0800
commit4612705ec297bc6ba714cb7a98f1be6aff77c4b8 (patch)
treedf6c86676b318c1ac5e9566259549805751bb5cd /src/ng
parent9577702e8d2519c1a60f5ac4058e63bd7b919815 (diff)
downloadangular.js-4612705ec297bc6ba714cb7a98f1be6aff77c4b8.tar.bz2
fix(ngIf): don't create multiple elements when changing from a truthy to another thruthy value.
Fixes #4852.
Diffstat (limited to 'src/ng')
-rw-r--r--src/ng/directive/ngIf.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ng/directive/ngIf.js b/src/ng/directive/ngIf.js
index 5ff889c2..6e845e28 100644
--- a/src/ng/directive/ngIf.js
+++ b/src/ng/directive/ngIf.js
@@ -60,7 +60,7 @@
}
/*
- The transition styles can also be placed on the CSS base class above
+ The transition styles can also be placed on the CSS base class above
*/
.animate-if.ng-enter, .animate-if.ng-leave {
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
@@ -92,16 +92,16 @@ var ngIfDirective = ['$animate', function($animate) {
$scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
if (toBoolean(value)) {
-
- childScope = $scope.$new();
- transclude(childScope, function (clone) {
- block = {
- startNode: clone[0],
- endNode: clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ')
- };
- $animate.enter(clone, $element.parent(), $element);
- });
-
+ if (!childScope) {
+ childScope = $scope.$new();
+ transclude(childScope, function (clone) {
+ block = {
+ startNode: clone[0],
+ endNode: clone[clone.length++] = document.createComment(' end ngIf: ' + $attr.ngIf + ' ')
+ };
+ $animate.enter(clone, $element.parent(), $element);
+ });
+ }
} else {
if (childScope) {