Bird
0
0

Identify the error in this Angular animation trigger definition:

medium📝 Debug Q14 of 15
Angular - Animations
Identify the error in this Angular animation trigger definition:
trigger('fade', [
  state('visible', style({ opacity: 1 })),
  state('hidden', style({ opacity: 0 })),
  transition('visible <=> hidden', animate('500ms')),
  transition('hidden => visible', animate('fast'))
])
Astyle() function is missing in states
BMissing quotes around state names
CTransitions cannot use '<=>' syntax
DThe 'fast' duration is invalid in animate()
Step-by-Step Solution
Solution:
  1. Step 1: Check animate() duration values

    Angular animate() requires duration in time units like '500ms' or '1s'. 'fast' is not valid.
  2. Step 2: Verify other parts

    State names have quotes, transitions use valid '<=>' syntax, and style() is used correctly.
  3. Final Answer:

    The 'fast' duration is invalid in animate() -> Option D
  4. Quick Check:

    animate() needs valid time units, not 'fast' [OK]
Quick Trick: Use time units like 'ms' or 's' in animate() durations [OK]
Common Mistakes:
  • Using words like 'fast' instead of time units
  • Forgetting quotes around state names
  • Misusing transition syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes