
Angular 20.2 introduces a delightfully simple way to animate elements as they enter and leave the screen. With zero imports and CSS doing all the heavy lifting, the new animate.enter and animate.leave attributes let you add smooth, modern transitions with minimal code and maximum sanity.
Alain Chautard
December 26, 2025
In Angular 20.2, CSS animations for transitions have evolved with a fairly simple API.
Let’s dive into it.
Here is an example of animation for an element entering the screen:

The first thing to know is that animations are 100% driven by CSS. If you’re not familiar with CSS animations, you can use the CSS animation generator mentioned in this post.
Note that AI tools can also assist you in generating proper CSS animations. In the case of the example above, I used the following CSS code:
.entering {
animation: slide-fade 2s;
}
@keyframes slide-fade {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
The code is almost self-explanatory: We transition from an opacity of 0 (invisible) 30 pixels from the bottom to an opacity of 1 (fully visible) at the right position, and this animation lasts for 2 seconds.

Once the CSS class is ready, all that is left to do is tell Angular to use it. Here is how:
<div class="enter-container" animate.enter="entering">
<p>I'm animated!</p>
</div>
That’s it! animate.enter is a specific attribute supported by the Angular compiler. It’s not a directive, which means no import needed. You can use it as-is.
Another attribute called animate.leave can be added as well.
Let’s create another transition to use when hiding the element:
.leaving {
opacity: 0;
transform: translateX(20px);
transition: opacity 500ms ease-out, transform 500ms ease-out;
}
This one moves to the side by 20 pixels and lasts 500 ms. We apply it by adding animate.leave to our element:
<div class="enter-container"
animate.enter="entering"
animate.leave="leaving">
<p>I'm animated!</p>
</div>
And that is how our element supports animations. You can find the full code example on Stackblitz here.
Note that if you want to animate entire routes rather than single elements, you can still use the API described in this tutorial of mine, which has been available since Angular 17.
Get the latest news and updates on developer certifications. Content is updated regularly, so please make sure to bookmark this page or sign up to get the latest content directly in your inbox.

Middleware: What It Is, How It Chains, and When to Write Your Own
Middleware is one of Laravel’s most tested certification topics because it sits at the core of the request lifecycle. This article goes beyond basic syntax to explain how middleware works internally, how the pipeline pattern processes requests, what happens when $next is skipped, and why some middleware never executes. If you want to truly understand Laravel middleware rather than just use it, this is where to start.
Steve McDougall
May 28, 2026

Rolldown and Vite 8: What Changed
Vite 8 replaced both esbuild and Rollup with Rolldown. Here's what that means for your Vue project in practice.
Reza Baar
May 27, 2026

Closures Explained: How Functions Remember Their Scope
A function in JavaScript remembers the scope it was created in, even after that scope has finished executing. Learn what closures are, why the loop bug happens, and how to use them in practice.
Martin Ferret
May 26, 2026