Bird
0
0

Which of the following is the correct syntax to declare a model signal in an Angular component?

easy📝 Syntax Q3 of 15
Angular - Signals
Which of the following is the correct syntax to declare a model signal in an Angular component?
A@Model() count = signal(0);
B@Input() count = 0;
Ccount = signal(0);
Dcount = new Signal(0);
Step-by-Step Solution
Solution:
  1. Step 1: Recall model signal syntax

    Model signals are declared by assigning signal(initialValue) to a property.
  2. Step 2: Check other options

    @Input() is for inputs, new Signal() is invalid, @Model() is not a valid decorator.
  3. Final Answer:

    count = signal(0); -> Option C
  4. Quick Check:

    Model signal syntax = property = signal(value) [OK]
Quick Trick: Use property = signal(initialValue) for model signals [OK]
Common Mistakes:
  • Using @Input() for model signals
  • Trying to instantiate Signal with new keyword
  • Using non-existent @Model() decorator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes