Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Angular error NG2003 means the compiler cannot find a runtime injection token for a constructor parameter. Check the parameter named in the diagnostic: if its type is an interface or another type erased from JavaScript, inject a shared InjectionToken; if it is a runtime class, make sure it has Angular injectable metadata. Then register the token or class with the appropriate provider.
What NG2003 means
Angular describes NG2003 as “There is no injection token for a constructor parameter at compile time.” It is a compiler error: Angular cannot determine the runtime key it needs to resolve that dependency. See Angular’s NG2003: Missing Token reference.
As an Amazon Associate I earn from qualifying purchases.
Some TypeScript types do not exist at runtime. Interfaces and generic-only types are erased when TypeScript is compiled, so Angular cannot use them directly as injection tokens. Primitive constructor parameter types, including string, number, boolean, and Object, are also common triggers.
Trace the parameter Angular cannot resolve
- Read the compiler diagnostic. Identify the constructor parameter Angular names.
- Inspect the class’s uses. Check where the class is instantiated or injected, and whether the parameter is intended to be a service, a configuration value, or another dependency.
- Check for a runtime token. A TypeScript interface or primitive type is not, by itself, a usable runtime key. For a class dependency, confirm that Angular can identify it as injectable. For an erased type or value, create an explicit token.
- Register the dependency. Add a provider for the class or token in the injector that needs to supply it.
Use an InjectionToken for interfaces and values
Define one exported InjectionToken for the value, then use that exact token instance both when registering the provider and when injecting the dependency. The description string helps identify the token in debugging, but it does not determine token identity. Two separately created tokens with the same description are still different keys. Angular documents this pattern in its InjectionToken API and dependency provider guide.
#1 Best Overall
import { InjectionToken, Inject } from '@angular/core';
export interface AppConfig {
apiUrl: string;
}
export const APP_CONFIG = new InjectionToken<AppConfig>('app.config');
// Register this same token instance in the relevant injector:
// { provide: APP_CONFIG, useValue: appConfig }
// Inject the same token in a class constructor:
// constructor(@Inject(APP_CONFIG) private config: AppConfig) {}
Keep the token in a shared module or file and import that exported constant wherever it is provided or injected. Register a value with a provider such as { provide: APP_CONFIG, useValue: appConfig }. If an appropriate default can be created centrally, an InjectionToken can also have a factory; consult the API reference for its factory options.
For class dependencies, check injectable metadata and providers
If the dependency is a class that exists at runtime, ensure Angular has the injectable metadata needed to use it. Angular’s NG2003 guidance points to @Injectable or @Inject as ways to make the dependency identifiable. Also ensure a provider is available in the injector where the dependency is requested. A recognized token without a provider can lead to a different error.
Rank #2
Distinguish NG2003 from NG0201
NG2003 and NG0201 describe different stages of dependency injection. NG2003 means Angular cannot identify a token for a constructor parameter at compile time. NG0201 (“No Provider Found”) means Angular has a token but cannot find a provider for it in the applicable injector. Fixing the missing token may therefore expose a provider-registration issue that needs its own remedy.
Version scope
Angular’s Error Encyclopedia currently identifies NG2003 as a compiler error; its page is labeled build Angular v22.2.1+sha-fa63bfa. The reference does not specify when the diagnostic was first introduced or document changes across versions, so consult the documentation corresponding to your installed Angular version if version history is relevant. The catalog is available at Angular Error Encyclopedia.
Quick Recap
Rank #4
Rank #3
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.




