Bird
0
0

Which of the following is the correct syntax to define an enter animation trigger in Angular?

easy📝 Syntax Q12 of 15
Angular - Animations
Which of the following is the correct syntax to define an enter animation trigger in Angular?
Atrigger('fadeIn', [transition('enter', [animate('500ms')])])
Btrigger('fadeIn', [state(':enter', style({opacity: 1}))])
Ctrigger('fadeIn', [animate(':enter', style({opacity: 1}))])
Dtrigger('fadeIn', [transition(':enter', [style({opacity: 0}), animate('500ms', style({opacity: 1}))])])
Step-by-Step Solution
Solution:
  1. Step 1: Recall Angular animation syntax

    Enter animations use transition(':enter', [...]) inside a trigger with defined styles and animate calls.
  2. Step 2: Check each option

    trigger('fadeIn', [transition(':enter', [style({opacity: 0}), animate('500ms', style({opacity: 1}))])]) correctly uses transition(':enter', [style(...), animate(...)]). The distractors misuse state, animate directly, or wrong transition name.
  3. Final Answer:

    trigger('fadeIn', [transition(':enter', [style({opacity: 0}), animate('500ms', style({opacity: 1}))])]) -> Option D
  4. Quick Check:

    Use transition(':enter', [...]) inside trigger [OK]
Quick Trick: Use transition(':enter', [...]) inside trigger for enter animations [OK]
Common Mistakes:
  • Using state() instead of transition() for :enter
  • Writing 'enter' without colon in transition
  • Calling animate() outside transition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes