Bird
0
0

What is wrong with this animation trigger?

medium📝 Debug Q7 of 15
Angular - Animations
What is wrong with this animation trigger?
trigger('fade', [transition(':enter', [style({opacity: 1}), animate('300ms', style({opacity: 0}))])])
AMissing trigger name in the function
BAnimation fades out on enter instead of fading in
Canimate() duration must be in seconds, not milliseconds
Dstyle() cannot be used inside transition
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the animation steps on ':enter'

    Starts at opacity 1 and animates to opacity 0, which means fade out on enter.
  2. Step 2: Understand expected behavior

    Usually, fade in means starting at 0 and animating to 1 on enter.
  3. Final Answer:

    Animation fades out on enter instead of fading in -> Option B
  4. Quick Check:

    Fade direction reversed = B [OK]
Quick Trick: Fade in means opacity 0 to 1 on enter [OK]
Common Mistakes:
  • Reversing opacity values causing wrong fade direction
  • Confusing milliseconds with seconds in animate()
  • Thinking style() is invalid inside transition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes