Life-Cycle Hooks

When you declaratively add or remove a child element, all Animations call specific hooks during the entering or exiting of the element.

Adding Child Elements

Each time you add a component to an entering animation, the Animations call the following hooks:

  • onEnterCalled before the animation starts.
  • onEnteringCalled after the animation started.
  • onEnteredCalled when the animation completes.
Example
View Source
Edit In Stackblitz  
Change Theme:

Removing Child Elements

Each time you remove a component from an existing animation, the Animations call the following hooks:

  • onExitCalled before the animation starts.
  • onExitingCalled after the animation started.
  • onExitedCalled when the animation completes.

At this point, the animated child is not available in the DOM. For DOM operations, pass a childFactory function.

Example
View Source
Edit In Stackblitz  
Change Theme:

In this article

Not finding the help you need?