WritableAtomSignal

Interface: WritableAtomSignal()<T>

Defined in: packages/angular-store/src/injectAtom.ts:21

A callable signal that reads the current atom value when invoked and exposes a .set method matching the atom's native setter contract.

This is the Angular-idiomatic return type for injectAtom. It can be used as a class property and called directly in templates.

Example

ts
readonly count = injectAtom(countAtom)

// read in template: {{ count() }}
// write in class:   this.count.set(5)
//                   this.count.set(prev => prev + 1)
readonly count = injectAtom(countAtom)

// read in template: {{ count() }}
// write in class:   this.count.set(5)
//                   this.count.set(prev => prev + 1)

Type Parameters

T

T

ts
WritableAtomSignal(): T;
WritableAtomSignal(): T;

Defined in: packages/angular-store/src/injectAtom.ts:23

Read the current value.

Returns

T

Properties

set

ts
set: (fn) => void & (value) => void;
set: (fn) => void & (value) => void;

Defined in: packages/angular-store/src/injectAtom.ts:25

Set the atom value (accepts a direct value or an updater function).