diff --git a/src/ngAnimate/animateCssDriver.js b/src/ngAnimate/animateCssDriver.js index 5cbaa1a041c4..c358130b814f 100644 --- a/src/ngAnimate/animateCssDriver.js +++ b/src/ngAnimate/animateCssDriver.js @@ -234,10 +234,12 @@ var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationPro // we special case the leave animation since we want to ensure that // the element is removed as soon as the animation is over. Otherwise - // a flicker might appear or the element may not be removed at all + // a flicker might appear or the element may not be removed until all + // the other animations have completed themselves (which would then + // leave a pending element in the background). options.event = animationDetails.event; - if (options.event === 'leave' && animationDetails.domOperation) { - options.onDone = animationDetails.domOperation; + if (options.event === 'leave') { + options.onDone = options.domOperation; } var animator = $animateCss(element, options); diff --git a/test/ngAnimate/animateCssDriverSpec.js b/test/ngAnimate/animateCssDriverSpec.js index bf0eec8bce7f..46b0b780c57a 100644 --- a/test/ngAnimate/animateCssDriverSpec.js +++ b/test/ngAnimate/animateCssDriverSpec.js @@ -908,10 +908,12 @@ describe("ngAnimate $$animateCssDriver", function() { inject(function($rootElement, $$rAF) { toAnimation.event = 'enter'; + toAnimation.options = {}; fromAnimation.event = 'leave'; + fromAnimation.options = {}; var leaveOp = function() { }; - fromAnimation.domOperation = leaveOp; + fromAnimation.options.domOperation = leaveOp; driver({ from: fromAnimation,