Below is a pragmatic “shopping list” for spotting the places in an Angular project that are prime candidates for migrating to the new Signals API (introduced in v16).
Follow it top-to-bottom and you will have a surprisingly good inventory of all the things that “want to become” signals.
1. Turn on the right tooling first
| Tool | Why you want it | How to enable |
|---|
| Angular DevTools ≥ v17 | Shows a live “Signals” tab that highlights every signal/computed/effect and how often they fire. Also warns when template still re-runs CD because of zone.js. | npm i -D @angular-devtools/extension then load the unpacked extension or update from Chrome store. |
ESLint plugin – @eslint/angular (beta) | Contains experimental rules that warn when you keep a BehaviorSubject that is only ever asObservable()-ed once, or when you inject NgZone unnecessarily. | npm i -D @eslint/angular and add recommended config. |
| Codemod schematics (CLI) | ng g @angular-devkit/schematics-cli:external @angular/core/signal-codemods (currently --next). Adds comments like // 👉 candidate for signal. | Needs Angular 17 nightly. Works surprisingly well on medium code bases. |
If you cannot or do not want to install any of that, the manual steps below still do the trick.
2. Search & replace heuristics (“grep party”)
Run these quick greps (or IDE “Find in project”) and drop the results in a sheet:
# state containers that often migrate 1-to-1
grep -R --line-number "new BehaviorSubject" src/
grep -R --line-number "new ReplaySubject" src/
grep -R --line-number "new SignalSubject" src/ # community libs
# template usage hints
grep -R --line-number "| async" src/app/**/*.html
grep -R --line-number "trackBy" src/app/**/*.html # may disappear
# imperative change-detection calls
grep -R --line-number ".markForCheck(" src/
grep -R --line-number ".detectChanges(" src/
grep -R --line-number "NgZone.run" src/
In practice, 80 % of the places above end up as:
• BehaviorSubject<number> → counter = signal(0)
• some$.pipe(map()) | async in template → someComputed() in TS → direct template binding
• markForCheck() → completely gone (signal change wakes template automatically)
3. Classify what you found
A simple decision tree:
Does this value represent "what is the latest value right now"?
| Yes --> Signal
|
No
|
Does it represent multiple chronological events (e.g. websocket, key presses)?
| Yes --> keep Observable/Subject
|
No
|
Could it be computed from other signals / inputs?
| Yes --> computed(...)
|
No --> probably still a stream, leave it
Grey areas? Keep it as an Observable for the moment; signals and observables inter-operate (toSignal, toObservable) so you can postpone the decision.
4. Low-hanging fruit you can migrate in <2 min each
@Input() that merely forwards value deeper to child components.
// Before
@Input() disabled = false;
isDisabled$ = this.disabledChange.pipe(startWith(this.disabled));
// After
@Input({ transform: toSignal }) disabled!: Signal<boolean>;
- Local
BehaviorSubject used only inside a single component/service.
private _mode$ = new BehaviorSubject<'list'|'grid'>('list');
// ↓
mode = signal<'list'|'grid'>('list');
store.select(...) | async in templates where you only ever need the current slice, not the stream.
Convert that selector to computed(() => this.store.selectSignal(selectTodoStats)) or let NgRx’s createSignalFromSelector helper do it (NgRx 16.2+).
5. Deal with template bindings
• Signals are NOT piped: just call them as functions.
{{ userName() }} instead of {{ userName$ | async }}.
• If you have dozens of templates, run this codemod:
npx @angular/core/signal-codemods template-to-signal
It will remove | async and append ().
Side-note: keep trackBy functions around lists until Angular’s future “for-of reactive” directive lands.
6. Mechanical refactor check-list
- Replace Subjects with
writable signal if you only do next()/value reads.
- Replace derived streams (
some$.pipe(map())) with computed.
- Replace side-effect‐reliant
subscribe calls that mutate class fields with effect.
- Remove
markForCheck/detectChanges—signals schedule CD automatically in v17 zone-less or in v16+ with setInputTracking.
- Keep Observables for: HTTP requests, WebSockets, router events, debounce/throttle, interval-based polling.
7. Verify with DevTools
- Open the new “Signals” panel.
- Interact with the app.
- Look for yellow highlights (lots of recomputations).
• Too many? Maybe an effect instead of computed or vice versa.
- If template still re-renders zones-style (blue flash in Components tab) you forgot to remove a Subject or a manual
NgZone.run.
8. Run e2e tests (there will be surprises)
Signals may expose timing assumptions—e.g. tests that awaited fixture.detectChanges() twice might now pass after one tick. Watch out for marble tests that expect a stream but you returned a signal. Adjust those expectations.
TL;DR
- Install DevTools + (optional) ESLint rules.
- Grep for Subjects,
| async, and manual CD calls—those are 90 % of the migration spots.
- Apply the “is it latest-value or event stream?” filter.
- Convert the straightforward cases to
signal, computed, or effect.
- Remove
markForCheck, drop | async, add ().
- Verify in DevTools, let tests guide the rest.
That’s the fastest, safest way to discover “what should be changed to signals” while keeping your sanity 🚀