Challenge - 5 Problems
Angular Animation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when this Angular animation triggers on element enter?
Consider this Angular animation trigger for an element entering the DOM:
What will the element's opacity be immediately after it finishes entering?
trigger('fadeIn', [
transition(':enter', [
style({ opacity: 0 }),
animate('500ms ease-in', style({ opacity: 1 }))
])
])What will the element's opacity be immediately after it finishes entering?
Attempts:
2 left
💡 Hint
Think about what the final style in the animate() function sets.
✗ Incorrect
The animation starts with opacity 0 and animates to opacity 1 over 500ms. After the animation, the element is fully visible with opacity 1.
📝 Syntax
intermediate2:00remaining
Which option correctly defines a leave animation in Angular?
You want to animate an element fading out when it leaves the DOM. Which animation trigger code is correct?
Attempts:
2 left
💡 Hint
Angular uses special keywords for enter and leave states.
✗ Incorrect
The correct keyword for leave animations is ':leave'. Options B and D use 'leave' without colon which is invalid. Option A uses ':exit' which is not recognized.
🔧 Debug
advanced2:00remaining
Why does this Angular leave animation not run?
Given this animation trigger:
And this template:
When 'show' becomes false, the element disappears instantly without animation. Why?
trigger('slideOut', [
transition(':leave', [
animate('400ms ease-out', style({ transform: 'translateX(100%)' }))
])
])And this template:
<div *ngIf="show" @slideOut>Slide me out</div>
When 'show' becomes false, the element disappears instantly without animation. Why?
Attempts:
2 left
💡 Hint
Angular removes elements immediately unless animations are properly hooked.
✗ Incorrect
Angular removes elements immediately unless the animation is attached to the element and Angular knows to wait for the animation to finish. The trigger is correct, but the element is destroyed before animation runs.
❓ state_output
advanced2:00remaining
What is the final style state after this enter and leave animation?
Consider this Angular animation trigger:
If the element is shown and then hidden, what opacity style will it have after the leave animation completes?
trigger('fadeToggle', [
transition(':enter', [
style({ opacity: 0 }),
animate('200ms', style({ opacity: 1 }))
]),
transition(':leave', [
animate('200ms', style({ opacity: 0 }))
])
])If the element is shown and then hidden, what opacity style will it have after the leave animation completes?
Attempts:
2 left
💡 Hint
What happens to elements after leave animations finish?
✗ Incorrect
After the leave animation finishes, Angular removes the element from the DOM, so no style remains on it.
🧠 Conceptual
expert3:00remaining
How does Angular coordinate multiple animations on nested elements during enter and leave?
You have a parent element with an enter animation and a child element with its own enter animation. When the parent enters, how does Angular handle the child's animation timing?
Attempts:
2 left
💡 Hint
Think about how Angular treats nested animations by default.
✗ Incorrect
By default, Angular runs nested animations in parallel unless you explicitly coordinate them with animation groups or sequences.