Bird
0
0

How can you create a signal that depends on another signal's value and updates automatically when it changes?

hard📝 Conceptual Q9 of 15
Angular - Signals
How can you create a signal that depends on another signal's value and updates automatically when it changes?
AManually call set() on dependent signal inside effect
BAssign dependent signal value directly without signal functions
CUse computed() with a function reading the other signal
DUse signal() with initial value only
Step-by-Step Solution
Solution:
  1. Step 1: Understand reactive dependencies in Angular

    Signals can depend on other signals using computed() to create derived values.
  2. Step 2: Use computed() to auto-update dependent signal

    computed(() => otherSignal() * 2) updates automatically when otherSignal changes.
  3. Final Answer:

    Use computed() with a function reading the other signal -> Option C
  4. Quick Check:

    Use computed() for derived reactive signals [OK]
Quick Trick: Use computed() to create signals depending on others [OK]
Common Mistakes:
  • Manually syncing signals instead of computed
  • Assigning values directly without signals
  • Using signal() only for static values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes