Angular · Senior · Question 69 of 75
Why does changing an object's property inside a signal not update the view?
user = signal({ name: 'Ann' });
rename() { this.user().name = 'Bob'; }- ✓Correct answer: The signal reference didn't change, so it didn't notify consumers; update immutably with
set/update - 2Signals can't hold objects
- 3It updates only after a page reload
Explanation
Write this.user.update((u) => ({ ...u, name: 'Bob' })). Signals compare with Object.is by default.