Open History to see the last commit
function injectAtom<TValue>(atom, options?): WritableAtomSignal<TValue>;
Defined in: packages/angular-store/src/injectAtom.ts:44
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.
Type Parameters#
TValue#
TValue
Parameters#
atom#
Atom<TValue>
options?#
InjectSelectorOptions<TValue>
Returns#
WritableAtomSignal<TValue>
Example#
readonly count = injectAtom(countAtom)
increment() {
this.count.set((prev) => prev + 1)
}