fix(ngSwitch): ensure correct iterator is passed to async function

Closes #8833
This commit is contained in:
The Big Red Geek
2014-09-04 12:41:47 +01:00
committed by Peter Bacon Darwin
parent 6d1e7cdc51
commit 712299c2a2

View File

@@ -154,11 +154,12 @@ var ngSwitchDirective = ['$animate', function($animate) {
for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
var selected = getBlockNodes(selectedElements[i].clone);
selectedScopes[i].$destroy();
var promise = previousLeaveAnimations[i] = $animate.leave(selected);
promise.then(function() {
previousLeaveAnimations.splice(i, 1);
});
promise.then((function(i) {
return function(){
previousLeaveAnimations.splice(i, 1);
};
}(i)));
}
selectedElements.length = 0;