AngularIntermediate

Angular Patterns That Scale: Signals, RxJS, Smart/Dumb

DeveloperHat Team
19 min read

TL;DR

Signals-first state, RxJS at the edges, smart/dumb components and feature shells — the Angular 22 patterns that keep a large app readable, with real trade-offs.

Angular 22 is the version where the framework's own defaults finally agree with each other: 22.0.0 shipped June 3, 2026, and the current patch is 22.3.0, from November 18, 2026. Signal-based APIs that arrived as developer previews across v20 and v21 — Signal Forms, the Resource API, httpResource() — are stable, new components default to OnPush change detection, and the runtime defaults to zoneless. The patterns that scale in this version are therefore not about fighting the framework; they are about drawing the same four boundaries every growing Angular app needs, and then letting the defaults do their work: signals for state, RxJS for streams that never complete, a smart/dumb split for components, and feature shells for team boundaries.

The short version: keep state in signals and derive with computed(); keep RxJS for the things signals cannot express — HTTP is already covered by httpResource(), so RxJS earns its place on websockets, debounced search, and event streams — and bridge the two with toSignal()/toObservable() instead of subscribing by hand. Split components into smart containers that own data and dumb presentational components that own markup, and split the app into lazily loaded feature shells that cannot import each other. Everything below is a variation on one rule: pick the pattern by what varies — state shape, async source, or team ownership. If nothing varies, a plain component is the whole design.

Four boundaries, one rule — pick the pattern by what varies App that scales readable as it grows Signals state that changes RxJS bridge streams that never end Smart / dumb data vs markup Feature shells one team per folder httpResource API as signals @defer + zoneless load + render less If nothing varies, write a plain component — the pattern is the cost.

Signals are the state primitive now

Signals are the default mental model in Angular 22, and the reason is not fashion — it is that the framework can see them. A signal is a value the framework tracks: when a signal changes, only the components that read it are checked, which is exactly what OnPush and the zoneless runtime need to be fast instead of merely tidy. The three primitives cover nearly all local state: signal() holds a value, computed() derives one, and effect() runs a side effect when a dependency changes. Signal-based inputs and outputs — input(), input.required(), output() — are the same idea applied to the component boundary: an input is a readable signal, an output is an emitter, and the parent passes values the way it always did. The signals guide is the reference for the full API; the shape of it is small enough to show whole, in a dumb component that owns no data of its own:

import { Component, input, output } from '@angular/core';

export interface UserRow {
  id: string;
  name: string;
  email: string;
  active: boolean;
}

@Component({
  selector: 'app-user-row',
  template: `
    <li class="row">
      <span>{{ user().name }}</span>
      <span>{{ user().email }}</span>
      <button (click)="toggle.emit(user().id)">
        {{ user().active ? 'Deactivate' : 'Activate' }}
      </button>
    </li>
  `,
})
export class UserRowComponent {
  user = input.required<UserRow>();
  toggle = output<string>();
}

Three details matter in practice. First, input.required() fails loudly when the parent forgets the binding, which is the behaviour you want from a required prop — the old @Input() failed silently at runtime. Second, the component reads user() as a function call in the template, so change detection knows exactly which signal the template depends on; nothing else in the tree is re-checked. Third, this component is trivially testable: set the input, assert the rendered markup, emit the output, assert the handler was called — no service to mock, no subscription to flush.

The honest limit: signals are a local-state primitive, not a state-management library. A signal holds a value; it does not know about undo history, optimistic updates, or cross-feature synchronization, and effect() is deliberately restricted — it runs after change detection, it cannot write to a signal it reads, and using it to derive state is the single most common signals mistake. Derive with computed(), run side effects with effect(), and when the state genuinely needs a store with actions and selectors, adopt one for that feature instead of bending signals into a framework. Our Angular 22 what's-new guide covers the version facts behind this section — which APIs went stable, and what the OnPush and zoneless defaults change for existing code.

Signals + RxJS: the bridge, not the war

The loudest argument in Angular 22 codebases is whether signals replace RxJS. They do not, and the framework does not ask them to. Signals model values that change; RxJS models streams of events over time. HTTP is the case that settled first: httpResource() turns a request into signals for value, error, loading, and status, re-running automatically when a signal it reads changes, so the fetch-and-subscribe pattern that used to live in ngOnInit is now a declaration. What remains for RxJS is the stream that never completes or never resolves to a single value: a websocket, a debounced search box, a stream of route parameters, a drag event. The bridge between the two worlds is toSignal() and toObservable(), and the rule is simple — cross the bridge once, at the boundary, and keep one side reactive and the other declarative.

A smart container shows the whole shape: httpResource() for the request, toSignal() for the live stream, and signal inputs carrying the result down to dumb components:

import { Component, inject, signal } from '@angular/core';
import { httpResource } from '@angular/common/http';
import { toSignal } from '@angular/core/rxjs-interop';
import { UserService } from './user.service';
import { UserRow } from './user-row.component';

@Component({
  selector: 'app-user-list',
  template: `
    @if (users.isLoading()) {
      <p>Loading users…</p>
    } @else if (users.error()) {
      <p>Could not load users.</p>
    } @else {
      <ul>
        @for (user of users.value() ?? []; track user.id) {
          <app-user-row [user]="user" (toggle)="onToggle($event)" />
        }
      </ul>
    }
    <p>Live count from the socket: {{ liveCount() }}</p>
  `,
})
export class UserListComponent {
  private usersApi = inject(UserService);
  private search = signal('');

  users = httpResource<UserRow[]>(() => `/api/users?q=${this.search()}`);

  // RxJS stays for the stream that never completes: a websocket count.
  liveCount = toSignal(this.usersApi.liveCount$, { initialValue: 0 });

  onToggle(id: string) {
    this.usersApi.toggle(id);
  }
}

Two details matter. First, httpResource() re-runs when search() changes, so the search box is a signal update and nothing else — no valueChanges subscription, no switchMap, no takeUntilDestroyed. Second, toSignal() with initialValue gives the template a value before the first socket message arrives, and the subscription it creates is destroyed with the component, so the manual-unsubscribe ceremony disappears with the manual subscription. The httpResource API reference confirms it has been stable since v22.0 and assumes JSON by default.

The anti-pattern to avoid is the hybrid that keeps both models in the same component: a BehaviorSubject mirrored into a signal by hand, an effect() that subscribes to an Observable, a signal updated inside a .subscribe() callback. Each of those is a second source of truth, and the bug they produce — a view that updates for one path and not the other — is found in production, not in review. If a value comes from a stream, convert it once with toSignal() and let the signal own it from there. If a value comes from a signal, convert it once with toObservable() when an operator is genuinely needed — debounceTime, switchMap, combineLatest — and convert the result back with toSignal() at the same boundary. One crossing, in one place, with a name that says what it is.

Smart and dumb components: the split that keeps tests honest

The smart/dumb split is the oldest Angular pattern in this article and the one that still does the most work. A smart component — also called a container — injects services, owns data loading, and handles events; it renders little markup of its own. A dumb component — presentational — takes signal inputs, emits outputs, and owns markup; it injects nothing, loads nothing, and knows nothing about where its data came from. The UserListComponent above is smart; UserRowComponent is dumb. The split earns its keep in three places: tests, reuse, and review.

Tests are the clearest win. A dumb component's test is a rendering test: set inputs, assert markup, fire outputs, assert handlers. There is no HTTP mock, no service stub, no TestBed configuration beyond the component itself. A smart component's test is a behaviour test: stub the service, assert the resource is created with the right URL, assert the toggle handler calls the service. Neither test needs the other's setup, and neither test breaks when the other side changes its markup. Reuse follows: the same UserRowComponent renders in the admin list, the search results, and the team picker, because it never assumed which page it was on. Review follows too: when a dumb component injects a service, the diff is visibly wrong — the file that should only know about markup now knows about the network, and the reviewer can ask why without reading the rest of the change.

The honest limit is that the split is a guideline, not a law, and applying it to every component produces its own tax: a form field does not need a container, a one-off page section does not need a presentational wrapper, and a smart component with a single dumb child is indirection for its own sake. The rule that works in practice is one smart component per route or per feature section, with dumb components for anything rendered twice or tested for its markup. And the split only works if it is enforced by the same defaults that make it fast: dumb components should stay OnPush — the v22 default for new components — and take immutable inputs, so a parent that mutates an object in place does not silently defeat the check. A dumb component that injects a service is a code smell; a smart component that renders a hundred lines of markup is a component that wants to be split.

Feature-shell architecture: boundaries that survive teams

Components scale within a feature; feature shells scale across teams. A feature shell is a lazily loaded route boundary: a folder per feature — features/billing, features/users — with its own routes, its own smart components, its own services, and a single public surface, usually the route itself. Nothing outside the shell imports from inside it. Shared UI lives in a shared folder of dumb components; shared domain logic lives in core services. The shape is deliberately boring, and the boredom is the point: when a second team starts work on billing, they open one folder, and the question "can I touch this file" has an answer that does not require a meeting.

Feature shells, layer by layer — the router enforces the boundary App shell — routes · lazy loadChildren / loadComponent Feature shells — billing · users · one team per folder Smart containers — inject services · httpResource · toSignal Dumb components — signal inputs · outputs · markup only Services + streams — RxJS at the edges · websockets · HTTP No feature imports another feature — shared code is promoted, never smuggled.

Lazy loading is what makes the boundary real instead of conventional. Angular's router loads a feature on demand, so the shell is a deployment fact — the billing code is not in the bundle the user downloads to see the dashboard — and not just a folder convention. The route file is the whole contract:

import { Routes } from '@angular/router';

export const routes: Routes = [
  {
    path: 'billing',
    loadChildren: () =>
      import('./features/billing/billing.routes').then((m) => m.BILLING_ROUTES),
  },
  {
    path: 'users',
    loadComponent: () =>
      import('./features/users/user-list/user-list.component').then(
        (m) => m.UserListComponent,
      ),
  },
];

loadChildren takes a whole feature with its own routes; loadComponent takes a single standalone component for a simple page. Standalone components have been the default since v17, so there is no module ceremony to maintain — the shell is a folder and a route, and the router enforces the boundary at build time by refusing to bundle what is not imported. The remaining enforcement is a lint rule, and it is worth adding: no import in features/billing may reference features/users, and no feature may import from another feature's internals. The rule is three lines in an ESLint boundary config, and it is the difference between a shell architecture and a folder with aspirations.

The honest limit: shells cost a decision per feature, and for a small app the cost is pure overhead — a three-page admin tool does not need six folders and a boundary lint rule. Shells earn their keep at the point where two teams, or two release trains, touch the same app: that is when an import across a boundary becomes a merge conflict, and when lazy loading starts saving real bundle size. Until then, one features folder with two or three shells and a shared folder is the whole architecture, and the discipline is to keep it that way rather than pre-building the enterprise layout. The same boundary thinking applies on the server side of the app — our hexagonal architecture guide covers ports and adapters in Spring Boot, Node, and Python, and the question of whether the ceremony is worth it.

Two smaller primitives complete the picture, and both are cheap enough to adopt without a decision meeting. @defer blocks, stable since v17, lazy-load a section of a page when it scrolls into view — the heavy chart below the fold costs nothing until the user reaches it — and in v22 they compose with incremental hydration, which is now the default, so deferred content hydrates in small parts instead of all at once:

@defer (on viewport) {
  <app-heavy-chart [data]="report()" />
} @placeholder {
  <p>Chart loads when you scroll to it.</p>
} @loading (minimum 300ms) {
  <p>Drawing the chart…</p>
}

The deferrable views guide documents the triggers — on viewport, on interaction, on idle, on timer — and the rule is to defer what is heavy and below the fold, not what the user sees first. The second primitive is the zoneless runtime, the default since v21: without zone.js patching every async operation, change detection runs only when a signal changes or an input updates, which is why the signal-first code above is fast rather than merely tidy. The zoneless guide is the reference if you are migrating an app that still depends on zone-patched behaviour, such as a third-party library that expects change detection after a setTimeout.

Head-to-head: the four patterns against the alternatives

ProblemThis patternThe alternativeWhat you trade
Local state changesSignals + computed()BehaviorSubject + async pipeSignals are tracked by the framework, so OnPush and zoneless stay fast; RxJS adds a subscription and a pipe for state that is just a value
Async data from an APIhttpResource()ngOnInit + subscribe + takeUntilDestroyedThe resource owns loading, error, and re-fetch on input change; the manual version owns all three, and forgets one of them in review
A stream that never completesRxJS + toSignal() at the boundarySignals updated from .subscribe()One conversion, one owner; the hybrid has two sources of truth and a view that updates for one path and not the other
A component used in two placesDumb component, signal inputs/outputsA component that injects its serviceRendering test needs no mocks; the injecting version cannot be reused without its backend
Two teams in one appFeature shells + lazy routesA flat app folderBoundaries the router enforces and a lint rule guards; the flat folder makes every import a potential merge conflict
Heavy content below the fold@defer (on viewport)Render everything, hide with CSSThe deferred code is not in the initial bundle and not hydrated; the hidden version costs both

The table is deliberately unromantic: no pattern here is clever, and none of them is new. Signals are the only genuinely recent piece, and even they are a refinement of the reactive primitive Angular has had since the beginning. What is new in v22 is that the framework's defaults point the same way the patterns do — OnPush, zoneless, stable resources — so following the patterns is now the path of least resistance instead of a discipline you maintain against the tooling. The comparison that matters most is the one in the next section: the patterns against doing nothing, which is the option most codebases are already running.

Architecture decision: signals-first, RxJS at the edges, smart/dumb, feature shells

  • Decision: Standardize on signals-first state with computed() for derivation, httpResource() for API data, RxJS confined to never-completing streams and bridged once with toSignal()/toObservable(), a smart/dumb component split with dumb components on signal inputs and outputs, and lazily loaded feature shells with a lint rule forbidding cross-feature imports.
  • Context: An Angular 22 codebase (22.0.0 June 3, 2026; current patch 22.3.0, November 18, 2026) with several teams adding features, where the recurring review findings are manual subscriptions that leak or forget to unsubscribe, prop drilling through four or more layers, components that mix data loading with markup, and a flat folder structure where every new feature touches files another team owns.
  • Options considered: (a) The four patterns above, on the v22 defaults. (b) Keep the current style — @Input()/@Output() decorators, manual subscriptions with takeUntilDestroyed, components that load their own data, a flat folder — and fix performance in review. (c) Adopt a state-management library and a component framework as the standard, so every feature follows the same opinionated structure.
  • Why this one: Option (b) is the status quo and its cost is visible in review: every new feature touches more files than it should, subscription bugs are found in production, and the flat folder turns every cross-feature change into a negotiation. Option (c) front-loads a framework decision the team has not earned yet — a store for state that is mostly local, a framework for pages that are mostly simple — and it hides the Angular patterns instead of teaching them. Option (a) fixes the actual findings with the smallest new surface: signals, resources, and @defer are stable framework APIs, the smart/dumb split is a convention rather than a dependency, and the feature shell is a folder plus a route. The same discipline, applied to React's component model, is covered in our React patterns guide — composition and hooks there, signals and shells here — and the two articles agree on the underlying rule: pick the pattern by what varies.
  • What it costs you: Indirection in the smart/dumb split — a reader must open the container to see where data comes from — and a boundary lint rule that must stay healthy: a shell that imports another shell's internals fails the build, so a genuinely shared piece has to be promoted to shared or core deliberately, which is slower than just importing it. Review has to catch the two failure modes: effect() used to derive state instead of computed(), and a dumb component that quietly injects a service.
  • When to reverse it: If a feature genuinely needs cross-feature, frequently changing shared state, adopt a store for that feature and document it; do not widen a dumb component's inputs or a shell's imports to cover it. If the team is one person and the app is three pages, drop the shells and keep the signals — the patterns above do not depend on the folder structure. Revisit whenever a second team asks for a shared component library: that is when the dumb components earn a formal home, and when the input/output contracts should be frozen.
  • Pick the pattern by what varies: state, stream, or team What varies? state · stream · team A value changes local state A stream never ends websocket · debounce Two teams touch it shared ownership Signal + computed derive, never effect RxJS + toSignal cross the bridge once Feature shell lazy route + lint rule A component used twice goes dumb; a feature a second team touches gets a shell.

    Recommendation

    For a new Angular 22 feature, apply the flowchart in order. If the state is a value that changes, hold it in a signal and derive with computed(); reach for effect() only for a genuine side effect. If the data comes from an API, fetch it with httpResource() and let the resource own loading and error states; if it comes from a stream that never completes, keep it in RxJS and cross the bridge once with toSignal(). If a component renders in two places, make it dumb — signal inputs, outputs, no injected services — and let a smart container own the data. If a second team will touch the feature, give it a shell, a lazy route, and no imports from any other shell. Defer what is heavy and below the fold with @defer, and leave what the user sees first alone.

    For an existing codebase, the migration is one pattern at a time and each step is safe on its own. Replace one manual subscription with toSignal() or httpResource(): the component loses its ngOnInit, its takeUntilDestroyed, and its teardown test. Replace one prop-drilling chain with signal inputs on a dumb component: the intermediate components lose props they never used. Replace one data-loading component with a smart/dumb pair: the markup gets a rendering test and the container gets a behaviour test. Split one feature into a shell with a lazy route: the bundle gets smaller and the next team's diff gets shorter. Each replacement is a small, testable change, and the design gets visibly simpler with every one.

    When NOT to use these patterns

    Do not adopt the full set for a prototype, a three-page admin tool, or a weekend spike — the shells and the lint rule are overhead until a second team or a second release train exists, and a prototype that needs to change shape daily is slowed by boundaries it has not earned. Do not convert every @Input() to a signal input in one change; the decorator inputs still work, and a bulk migration creates a diff no reviewer can meaningfully approve — convert components as you touch them, and leave tested components alone. Do not put a signal behind every value: a constant, a one-off configuration object, and a value that never changes are plain properties, and wrapping them in signals adds ceremony without a reader. Do not use effect() to synchronize two signals — that is computed()'s job, and an effect that writes a signal is a loop waiting for its second iteration. And do not reach for a state-management library because the app feels large; reach for it when a specific feature's state is genuinely shared, frequently changing, and painful in signals — then adopt it for that feature, document the decision, and keep the rest of the app on the patterns above.

    Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.