Bird
0
0

Which is the correct syntax to define a state named active with a red background color?

easy📝 Syntax Q3 of 15
Angular - Animations
Which is the correct syntax to define a state named active with a red background color?
Astate('active', style({ backgroundColor: 'red' }))
Bstate(active, style('background-color: red'))
Cstate('active', { backgroundColor: 'red' })
Dstate('active', style('red'))
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct state syntax

    The state function takes a name string and a style function with an object of CSS properties. state('active', style({ backgroundColor: 'red' })) correctly uses this syntax.
  2. Final Answer:

    state('active', style({ backgroundColor: 'red' })) -> Option A
  3. Quick Check:

    state syntax = state(name, style(object)) [OK]
Quick Trick: Use style({property: value}) inside state() [OK]
Common Mistakes:
  • Passing style as string instead of object
  • Omitting quotes around state name
  • Using incorrect style function syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes