Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2cb850e

Browse files
committed
fixed for igor
1 parent bd07dc4 commit 2cb850e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/ng/directive/ngSwitch.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,17 @@ var ngSwitchDirective = ['$animate', function($animate) {
145145
selectedScopes = [];
146146

147147
scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
148-
var i, ii, promise;
148+
var i, ii;
149149
for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {
150-
promise = previousLeaveAnimations[i];
151-
if (promise) {
152-
$animate.cancel(promise);
153-
}
150+
$animate.cancel(previousLeaveAnimations[i]);
154151
}
155152
previousLeaveAnimations.length = 0;
156153

157154
for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
158155
var selected = getBlockNodes(selectedElements[i].clone);
159156
selectedScopes[i].$destroy();
160157

161-
promise = previousLeaveAnimations[i] = $animate.leave(selected);
158+
var promise = previousLeaveAnimations[i] = $animate.leave(selected);
162159
promise.then(function() {
163160
previousLeaveAnimations.splice(i, 1);
164161
});

test/ng/directive/ngSwitchSpec.js

-2
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,6 @@ describe('ngSwitch animation', function() {
370370

371371
$scope.$apply('inc = "one"');
372372

373-
$scope.$apply('inc = "two"');
374-
375373
expect(destroyed).toBe(true);
376374
});
377375
});

0 commit comments

Comments
 (0)