@elemental/common / Function

computedSignal

Deprecated

Use linkedSignal instead. Will be removed in v1.0.0. A temporary function that simulate the https://next.angular.dev/api/core/linkedSignal Used to create a computed signal that is also writable. For example when you have an input signal and you want to create a computed signal that depends on it and can be writable.

Generic types:T R

No documentation has been provided.

Presentation

function computedSignal(
  signalRef: Signal<T> | InputSignal<T> | InputSignalWithTransform<T, unknown>,
): WritableSignal<R>;

Returns

Parameters

NameTypeDescription
signalRef
Signal<T> | InputSignal<T> | InputSignalWithTransform<T, unknown>

@param signalRef The signal to be depend on

Overloads

Overload #1

No documentation has been provided.

Presentation
Parameters
NameTypeDescription
signalRef
Signal<T> | InputSignal<T> | InputSignalWithTransform<T, unknown>

@param signalRef The signal to be depend on

Returns
Example usage
myInputSignal = input(1);
myComputedSignal = computedSignal(myInputSignal, (value, previousValue) => (value * 2));
...
myComputedSignal.set(10);
Overload #2

No documentation has been provided.

Presentation
computedSignal(signalRef: Signal<T> | InputSignal<T> | InputSignalWithTransform<T, unknown>, onReset: OnResetFn<T, R>): WritableSignal<R>;
Parameters
NameTypeDescription
signalRef
Signal<T> | InputSignal<T> | InputSignalWithTransform<T, unknown>
onReset
OnResetFn<T, R>
Returns

Example usage

myInputSignal = input(1);
myComputedSignal = computedSignal(myInputSignal, (value, previousValue) => (value * 2));
...
myComputedSignal.set(10);