← Back to Web app developers
See how it helps
1. Signals fundamentals (
2. RxJS and Signals interop (
Angular signals and state
Assigns state ownership and combines synchronous Signals with asynchronous RxJS without redundant copies or hidden dependencies.
angular-signals-state
Team members using this skill
When is it useful?
Use when Angular screens contain competing state stores, unnecessary effects or changes that fail to update the view.
What does it help you do?
- Keeps writable state in the narrowest suitable component, route or service scope.
- Derives values with pure computations and exposes shared state read-only.
- Checks supported APIs and lifecycle behavior when bridging signals and observable streams.
Try asking this
Simplify our product filters with one state owner, computed totals and cancellable search, using APIs supported by this project. Change category and price together, then clear both. The displayed count should follow derived state without a second writable copy drifting out of sync.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Signals & State Management
Match Signals and RxJS to the nature of the state: use Signals for synchronous reactive state and derived UI values, and RxJS for event streams, cancellation and complex async coordination.
1. Signals fundamentals (signal, computed, effect)
- Check the project's Angular version before using signal APIs (
signal/computed/effectin v16–17+,input/output/modelin v17.1+,linkedSignal/resourcein v19+). signal(): own writable synchronous state in the narrowest component or service scope; expose.asReadonly()from services so consumers cannot mutate shared state bypassing service methods.computed(): derive values declaratively (filteredItems,isValid,total).computedgetters must be pure and free of side effects.effect(): use sparingly for true side effects (logging, syncing tolocalStorage, imperative DOM/canvas APIs). Never useeffect()to copy or synchronize state that can be expressed withcomputed()orlinkedSignal().
2. RxJS and Signals interop (@angular/core/rxjs-interop)
toSignal(obs$, { initialValue }): bridge an observable into a synchronous template-friendly signal; call it in an injection context (field initializer or constructor) and remember it subscribes immediately for the component/service lifetime.toObservable(sig): bridge a signal into an RxJS pipeline when you needdebounceTime,switchMapcancellation or multi-step async operators; remembertoObservableemits asynchronously via an internal effect, so intermediate synchronous writes within the same tick coalesce.
3. Shared service and store architecture
- Keep state in the narrowest suitable scope: component-local signals/fields first, route/feature-scoped service or SignalStore/ComponentStore next, and root-level store only for genuine cross-app state.
- Update object and array state immutably (
sig.update(list => [...list, item])) soOnPushcomponents andcomputedconsumers detect changes reliably.
Before you finish
- Every piece of state has a single source of truth; read-only signals or streams exposed from shared services.
- Derived state uses
computed()or pure RxJS operators, nevereffect()state copying. -
toSignal/toObservableused in a valid injection context with clear error and initial-value handling.
Included files 2
LICENSE.txtSKILL.md
