| id | injectAtom |
|---|---|
| title | injectAtom |
function injectAtom<TValue>(atom, options?): WritableAtomSignal<TValue>;Defined in: packages/angular-store/src/injectAtom.ts:59
Returns a WritableAtomSignal that reads the current atom value when
called and exposes a .set method for updates.
Use this when a component needs to both read and update the same writable atom.
TValue
Atom<TValue> | () => Atom<TValue>
InjectSelectorOptions<TValue>
WritableAtomSignal<TValue>
readonly count = injectAtom(countAtom)
increment() {
this.count.set((prev) => prev + 1)
}