Bird
0
0

Identify the error in this animation trigger:

medium📝 Debug Q6 of 15
Angular - Animations
Identify the error in this animation trigger:
trigger('slide', [
  state('left', style({ transform: 'translateX(0)' })),
  state('right', style({ transform: 'translateX(100%)' })),
  transition('left => right', animate('500ms')),
  transition('right => left', animate('500ms')
])
AIncorrect style property name
BMissing closing bracket in the last transition
CWrong trigger name
DAnimate duration must be a number, not string
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of transitions

    The last transition line is missing a closing parenthesis after animate('500ms').
  2. Step 2: Verify other parts

    Style properties and trigger name are correct; animate duration as string with units is valid.
  3. Final Answer:

    Missing closing bracket in the last transition -> Option B
  4. Quick Check:

    Check parentheses in transition definitions [OK]
Quick Trick: Count parentheses carefully in animation arrays [OK]
Common Mistakes:
  • Forgetting closing parentheses
  • Misnaming CSS properties
  • Misunderstanding animate() parameter types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes