Bird
0
0

Why might an Angular animation transition using transition('open => closed', [animate('500ms')]) not run when the state changes from 'closed' to 'open'?

hard📝 Conceptual Q10 of 15
Angular - Animations
Why might an Angular animation transition using transition('open => closed', [animate('500ms')]) not run when the state changes from 'closed' to 'open'?
ABecause the transition is only defined from 'open' to 'closed', not the reverse
BBecause the animate duration is too short
CBecause the trigger name is missing
DBecause Angular animations do not support reverse transitions
Step-by-Step Solution
Solution:
  1. Step 1: Analyze transition direction

    The transition is defined only for 'open => closed', so it won't run when going from 'closed' to 'open'.
  2. Step 2: Understand Angular animation behavior

    Reverse transitions must be explicitly defined or use '<=>' syntax for two-way transitions.
  3. Final Answer:

    Because the transition is only defined from 'open' to 'closed', not the reverse -> Option A
  4. Quick Check:

    Transitions are directional unless '<=>' is used [OK]
Quick Trick: Define both directions or use '<=>' for two-way transitions [OK]
Common Mistakes:
  • Assuming animate duration affects direction
  • Thinking trigger name affects transition direction
  • Believing Angular auto-runs reverse transitions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes