diff --git a/adev/src/content/guide/signals/linked-signal.md b/adev/src/content/guide/signals/linked-signal.md index 0f721ec8041..d1ab6f18b05 100644 --- a/adev/src/content/guide/signals/linked-signal.md +++ b/adev/src/content/guide/signals/linked-signal.md @@ -63,13 +63,13 @@ In the example above, `selectedOption` always updates back to the first option w export class ShippingMethodPicker { shippingOptions: Signal = getShippingOptions(); - selectedOption = linkedSignal({ + selectedOption = linkedSignal({ // `selectedOption` is set to the `computation` result whenever this `source` changes. - source: shippingOptions, + source: this.shippingOptions, computation: (newOptions, previous) => { // If the newOptions contain the previously selected option, preserve that selection. // Otherwise, default to the first option. - return newOptions.find(opt => opt.id === previous?.value) ?? newOptions[0]; + return newOptions.find(opt => opt.id === previous?.value?.id) ?? newOptions[0]; } });