An Angular signal’s update method derives a replacement value from the signal’s current value. It accepts a callback, passes that callback the previous value, and stores the callback’s return value. Unlike directly calculating a value before calling set, update keeps the read-and-derive operation together. section 6.2.2 section 6.8
Use update when the next value depends on the existing signal value:
- Increment a numeric signal with count.update(value => value + 1). section 6.2.2
- Add an item to an array by returning a new array that spreads the previous items and appends the new value. section 6.2.2
- Return a value matching the signal’s declared type; a numeric signal’s callback cannot return an array or another incompatible value. section 6.2.2
Approving a time-off request
A component can update an array of request objects without replacing it manually at the call site. The callback locates the request, maps the existing array, and returns a new array in which the matching item has status 'Approved'. The same pattern supports request rejection and other enterprise workflow changes. section 6.3.2
