ModelSignal represents a special Signal for a directive/component model field.
API
interface ModelSignal<T> extends WritableSignal<T>, InputSignal<T>, OutputRef<T> {
[SIGNAL]: InputSignalNode<T, T>;
override set(value: T): void;
override update(updateFn: (value: T) => T): void;
override asReadonly(): Signal<T>;
override subscribe(callback: (value: T) => void): OutputRefSubscription;
}
[SIGNAL]
InputSignalNode<T, T>set
voidDirectly set the signal to a new value, and notify any dependents.
T
void
update
voidUpdate the value of the signal based on its current value, and notify any dependents.
(value: T) => T
void
asReadonly
Signal<T>Returns a readonly version of this signal. Readonly signals can be accessed to read their value but can't be changed using set or update methods. The readonly signals do not have any built-in mechanism that would prevent deep-mutation of their value.
Signal<T>
subscribe
OutputRefSubscriptionRegisters a callback that is invoked whenever the output emits a new value of type T.
Angular will automatically clean up the subscription when the directive/component of the output is destroyed.
(value: T) => void
OutputRefSubscription
Description
ModelSignal represents a special Signal for a directive/component model field.
A model signal is a writeable signal that can be exposed as an output. Whenever its value is updated, it emits to the output.