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'; }

Explanation

Write this.user.update((u) => ({ ...u, name: 'Bob' })). Signals compare with Object.is by default.

Further reading

Problem with a question

Angular · Senior · question 69

Test yourself

Take the Angular · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz