• Genel Bakış
@angular/core

linkedSignal

function
kararlıv20.0'den beri

Creates a writable signal whose value is initialized and reset by the linked, reactive computation.

API

function linkedSignal<D>(
  computation: () => D,
  options?:
    | {
        equal?: ValueEqualityFn<NoInfer<D>> | undefined;
        debugName?: string | undefined;
        set?:
          | ((value: NoInfer<D>, rawSet: (value: NoInfer<D>) => void) => void)
          | undefined;
      }
    | undefined,
): WritableSignal<D>;
function linkedSignal<S, D>(options: {
  source: () => S;
  computation: (
    source: NoInfer<S>,
    previous?: { source: NoInfer<S>; value: NoInfer<D> } | undefined,
  ) => D;
  equal?: ValueEqualityFn<NoInfer<D>> | undefined;
  debugName?: string | undefined;
  set?:
    | ((value: NoInfer<D>, rawSet: (value: NoInfer<D>) => void) => void)
    | undefined;
}): WritableSignal<D>;
function linkedSignal<D>(computation: () => D, options?: { equal?: ValueEqualityFn<NoInfer<D>> | undefined; debugName?: string | undefined; set?: ((value: NoInfer<D>, rawSet: (value: NoInfer<D>) => void) => void) | undefined; } | undefined): WritableSignal<D>;

Creates a writable signal whose value is initialized and reset by the linked, reactive computation.

@paramcomputation() => D
@paramoptions{ equal?: ValueEqualityFn<NoInfer<D>> | undefined; debugName?: string | undefined; set?: ((value: NoInfer<D>, rawSet: (value: NoInfer<D>) => void) => void) | undefined; } | undefined
@returnsWritableSignal<D>
function linkedSignal<S, D>(options: { source: () => S; computation: (source: NoInfer<S>, previous?: { source: NoInfer<S>; value: NoInfer<D>; } | undefined) => D; equal?: ValueEqualityFn<NoInfer<D>> | undefined; debugName?: string | undefined; set?: ((value: NoInfer<D>, rawSet: (value: NoInfer<D>) => void) => void) | undefined; }): WritableSignal<D>;

Creates a writable signal whose value is initialized and reset by the linked, reactive computation. This is an advanced API form where the computation has access to the previous value of the signal and the computation result.

Note: The computation is reactive, meaning the linked signal will automatically update whenever any of the signals used within the computation change.

@paramoptions{ source: () => S; computation: (source: NoInfer<S>, previous?: { source: NoInfer<S>; value: NoInfer<D>; } | undefined) => D; equal?: ValueEqualityFn<NoInfer<D>> | undefined; debugName?: string | undefined; set?: ((value: NoInfer<D>, rawSet: (value: NoInfer<D>) => void) => void) | undefined; }
@returnsWritableSignal<D>
Detaylara atla