angular/aio/content/errors/NG2003.md
Joe Martin (Crowdstaffing) bf1294ba69 docs: apply suggestions from code review (#45325)
Apply editorial suggestions for peer review.

Co-authored-by: Tiffany Davis <88161089+TMDavisGoogle@users.noreply.github.com>

PR Close #45325
2022-04-08 19:36:30 +00:00

20 lines
878 B
Markdown

@name Missing Token
@category compiler
@shortDescription No suitable injection token for parameter
@description
There is no injection token for a constructor parameter at compile time. [InjectionTokens](api/core/InjectionToken) are tokens that can be used in a Dependency Injection Provider.
@debugging
Look at the parameter that throws the error, and all uses of the class.
This error is commonly thrown when a constructor defines parameters with primitive types such as `string`, `number`, `boolean`, and `Object`.
Use the `@Injectable` method or `@Inject` decorator from `@angular/core` to ensure that the type you are injecting is reified \(has a runtime representation\). Make sure to add a provider to this decorator so that you do not throw [NG0201: No Provider Found](errors/NG0201).
<!-- links -->
<!-- external links -->
<!-- end links -->
@reviewed 2022-02-28