Bird
0
0

Which of the following is the correct way to create a signal in Angular?

easy📝 Syntax Q12 of 15
Angular - Signals
Which of the following is the correct way to create a signal in Angular?
Aconst count = new Observable(0);
Bconst count = signal(0);
Cconst count = subscribe(0);
Dconst count = createObservable(0);
Step-by-Step Solution
Solution:
  1. Step 1: Recall Angular signal creation syntax

    Signals are created using the signal() function with an initial value.
  2. Step 2: Identify incorrect options

    Observable creation uses new Observable(), subscribe is a method, and createObservable() is not valid.
  3. Final Answer:

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

    signal() creates signals [OK]
Quick Trick: Use signal() function to create signals [OK]
Common Mistakes:
  • Using new Observable() to create a signal
  • Confusing subscribe() with signal creation
  • Using non-existent createObservable() function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes