Bird
0
0

Identify the error in this Angular animation code snippet:

medium📝 Debug Q14 of 15
Angular - Animations
Identify the error in this Angular animation code snippet:
trigger('fadeIn', [
  transition(':enter', [
    animate('1s', keyframes([
      style({ opacity: 0, offset: 0 }),
      style({ opacity: 1 })
    ]))
  ])
])
AIncorrect trigger name syntax
Banimate duration should be a number, not a string
CMissing offset value in second style inside keyframes
Dtransition selector ':enter' is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check keyframe style objects for offsets

    Each style in keyframes should have an offset between 0 and 1 to define timing precisely.
  2. Step 2: Identify missing offset

    The second style lacks an offset property, which is required for keyframes to work correctly.
  3. Final Answer:

    Missing offset value in second style inside keyframes -> Option C
  4. Quick Check:

    All keyframe styles need offset [OK]
Quick Trick: Every keyframe style needs an offset between 0 and 1 [OK]
Common Mistakes:
  • Omitting offset in some keyframe styles
  • Using wrong transition selectors
  • Passing duration as number instead of string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes