Bird
0
0

Given this trigger definition:

medium📝 Predict Output Q4 of 15
Angular - Animations
Given this trigger definition:
trigger('toggle', [
  state('on', style({ opacity: 1 })),
  state('off', style({ opacity: 0 })),
  transition('on => off', animate('500ms'))
])

What happens when the state changes from 'on' to 'off'?
AThe element fades out over 500 milliseconds
BThe element instantly becomes invisible
CThe element fades in over 500 milliseconds
DNo animation occurs
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the transition definition

    The transition 'on => off' uses animate('500ms'), changing opacity from 1 (visible in 'on' state) to 0 (invisible in 'off' state), so the element fades out over 500 milliseconds.
  2. Final Answer:

    The element fades out over 500 milliseconds -> Option A
  3. Quick Check:

    Transition 'on => off' = fade out 500ms [OK]
Quick Trick: Transition defines animation duration between states [OK]
Common Mistakes:
  • Assuming instant change without animation
  • Confusing fade out with fade in
  • Ignoring transition timing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes