Skip to content

Latest commit

 

History

History
54 lines (34 loc) · 1.25 KB

File metadata and controls

54 lines (34 loc) · 1.25 KB
id WritableAtomSignal
title 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

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

WritableAtomSignal(): T;

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

Read the current value.

Returns

T

Properties

set

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).