Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

Angular NG0602: How to Fix “Disallowed Function Call Inside Reactive Context”

Angular NG0602 occurs when a disallowed function runs inside a reactive context. Learn how to trace the call and move it to the right place.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Angular’s NG0602 means code called a function that is not allowed to run while Angular is tracking a reactive computation. Find the function named in the error, trace how it was called, and move the operation—often creating an effect, scheduling a render hook, or wrapping an observable with toSignal()—outside the computed callback or template evaluation.

What NG0602 means

Angular tracks signal reads while it evaluates reactive code, connecting the values read to the computation that may need to run again. This happens in computed() and linkedSignal() calculations, effect callbacks, resource parameters or loaders, and component template rendering, including host property bindings. When a tracked signal changes, its consumer may run again. See Angular’s signals guide.

These reactive computations should generally derive values from state, not create new work as a side effect. Creating an effect, scheduling a render callback, or subscribing to an observable from a computation that may reevaluate can cause repeated work or unintended subscriptions. A template expression is also evaluated in a reactive context, so a prohibited call can be triggered indirectly by a template.

How to find the call that caused NG0602

  1. Read the complete error and note the function Angular names as disallowed.
  2. Open the browser’s stack trace and follow it to the application call site.
  3. Trace upward through any helper functions to find the reactive caller: a computed or other reactive callback, or a template expression.
  4. Move the creation, scheduling, or subscription operation outside that reactive execution where possible.
  5. Repeat the application path that produced the error and check that the operation now happens at its intended setup or lifecycle point.

Angular’s NG0602 error guide recommends inspecting the named function and using the stack trace to locate where it was invoked and defined. If a helper must only be called outside reactive execution, assertNotInReactiveContext can make that expectation explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix common NG0602 triggers

effect() called from a computed or template path

Create the effect outside the reactive callback or template call path. A component, directive, or service constructor is a straightforward location when an injection context is available. If you create an effect elsewhere, Angular’s effects guide documents supplying an Injector in the effect options.

These are separate constraints: effect() must not be invoked inside an active reactive context, and it also needs an injection context unless an injector is supplied. Moving the call can resolve NG0602 without resolving a separate injection-context error. An effect runs at least once and tracks signal reads during its execution, so create it where that behavior is intended.

afterNextRender() or afterEveryRender() scheduled in computed()

Schedule the render hook outside the computed callback, such as during component setup. If a computed reevaluates and schedules another hook each time, Angular may accumulate repeated work and hurt performance. Although Angular’s error guide mentions untracked as an opt-out, moving hook creation is the ordinary fix.

toSignal() called inside computed()

Create the signal wrapper once outside the computation, then read that signal inside the computed calculation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const dataSignal = toSignal(dataObservable$);

const derived = computed(() => {
  const data = dataSignal();
  return /* derive a value from data */;
});

This separates setting up the observable-to-signal conversion from deriving a value that can be recalculated. If restructuring is not possible, Angular’s error guide suggests considering a manual observable subscription; choose that only if its lifecycle and cleanup fit your code.

When to use computed(), linkedSignal(), and effects

Choose an API based on what the code needs to do, rather than using an effect to relay every state change. Angular recommends computed() for derived state, linkedSignal() when derived state must also be writable, and effects for synchronizing signals with imperative, non-signal APIs such as storage, logging, custom DOM behavior, or third-party libraries. See the effects guide.

Use untracked only when you want different dependency tracking

untracked(fn) runs fn without attaching signal reads made inside it as dependencies of the surrounding reactive consumer. This is a real change in behavior, not a semantics-free way to silence NG0602: a value read inside the wrapper will not make the surrounding computation rerun when that signal changes. It can make sense for incidental reads or external code whose signal reads should not trigger reevaluation, but not as a substitute for moving effect creation, render scheduling, or observable setup to the right place. Angular describes it in the signals guide and its NG0602 guidance.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A related tracking detail: asynchronous effects

Signal tracking is synchronous. In an async effect, reads made after an await are not tracked. If a signal’s current value should determine whether the effect reruns, read it before the asynchronous boundary and retain that value for the later work. This tracking rule is distinct from NG0602, but it matters when restructuring reactive code.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.