• 개요
@angular/core

linkedSignal

함수
안정화v20.0부터

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>
상세 내용으로 이동