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

Parent directive element doesn't wait for child animations to complete before being removed from DOM. #12003

Closed
@Guardiannw

Description

@Guardiannw

The issue occurs whenever I have at least two custom directives that are toggled by an ng-switch. I listen to the leave event on the directive so that I can transition out some of the child elements before it removes the parent from the DOM and switches to the other directive. NgAnimate is not waiting for the child animations to complete before it removes the parent from the DOM in order to display the other directive in the ng-switch.

This is important because I need to be able to transition out the directive's child elements before the directive is switched. For instance, I have a directive that has an ng-repeat in its template, and I want to stagger animate out all of the elements in that ng-repeat before the entire directive is removed from the DOM.

Angular Version: 1.4.0

The plunker demonstrating the lack of animation on the ng-repeat items is here: http://plnkr.co/edit/uV5PJcVCROPXgSvYUy10

I think that the problem is in the scope of the element. The things in the scope.$apply are not getting called. I have also tried this with the $destroy event on the element and it does the same thing. I am pretty positive this needs to be called in an $apply block or with a $digest following it in order to animate however.

That being said; if animations do perform, then they still need to hold off the parent element's removal and switching until they are completed.

Thanks guys,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions