October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Angular linkedSignal: When Derived State Needs a Writable Override

Angular linkedSignal lets derived state be writable while re-synchronizing from dependencies. See when to use it and how its previous-aware form can preserve valid selections.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

linkedSignal is for Angular state that should normally follow other state but still allow direct writes. Its computation supplies the value when linked dependencies change; between those updates, application code can override it. Use computed instead when callers must not be able to write the derived value.

What does linkedSignal do?

Angular’s linkedSignal creates a writable signal whose initial value and subsequent resets come from a reactive computation. It sits between two common needs: signal stores independent writable state, while computed exposes a read-only value derived from other signals.

As an Amazon Associate I earn from qualifying purchases.

The API reference marks linkedSignal stable since Angular v20.0. Check the Angular version installed in your project and the matching API documentation before adopting it, because the current syntax and availability depend on that version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When should you use linkedSignal?

Use it when a derived value needs to be temporarily or directly changed by application code, yet should be recalculated when its dependencies change. For example, a notification preference might default to enabled when a user is online while still allowing the user to disable notifications manually.

import { linkedSignal, signal } from '@angular/core';

const userStatus = signal<'online' | 'away' | 'offline'>('offline');
const notificationsEnabled = linkedSignal(() => userStatus() === 'online');

notificationsEnabled.set(true); // A manual override is allowed.
userStatus.set('online');       // A dependency change can re-sync the value.

Here, notificationsEnabled is writable, unlike a computed signal. When the linked computation runs because its dependency changes, it supplies the linked value again. Choose this model when that re-synchronization is the intended behavior.

How do you keep a selection valid when its options change?

The source-and-computation overload is useful when a derived choice depends on a changing collection. If a user selected an option and the available options change, always choosing the first item can discard a selection that remains valid. The computation can inspect the new source and the previous source and linked value, then retain the old choice if it is still available or choose a valid fallback.

linkedSignal({
  source: options,
  computation: (newOptions, previous) => {
    const previousChoice = previous?.value;
    return previousChoice && newOptions.includes(previousChoice)
      ? previousChoice
      : newOptions[0];
  },
});

This illustrates the decision, not a complete component: define the option types and handle an empty list according to the application’s requirements. In this overload, the computation receives the new source and a previous object containing the previous source and linked value.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular’s guide also documents custom equality comparison and an optional custom set operation. A custom setter can route writes back to a source of truth; use it deliberately so it remains clear which part of the application owns the state.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Should you use signal, computed, linkedSignal, or effect?

Need Use Why
Independent state that application code writes signal Stores a writable value without deriving it from other signals.
A value always derived from dependencies and never manually changed computed Provides a read-only derived value.
A value derived from dependencies that must also be writable linkedSignal Allows writes while remaining reactively linked; its computation supplies the value when linked dependencies change.
Synchronization with an imperative API or another non-signal system effect Effects are intended for side effects, not for copying derived signal state.

For read-only derivation, prefer computed. For writable derived state, use linkedSignal. Angular recommends effects for synchronizing with imperative APIs and other side effects rather than mirroring one signal into another.

What should you check before adopting it?

  • Confirm the project’s Angular version and verify the API against documentation for that release.
  • Decide what should happen to a manual override when linked dependencies change; the computation will supply the value again.
  • For changing collections, decide explicitly whether a previous choice remains valid and what fallback to use if it does not.
  • Keep state ownership clear if using a custom setter to route writes elsewhere.
  • Do not use an effect solely to copy a derived value when computed or linkedSignal expresses the relationship directly.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.