11 lines
902 B
Markdown
11 lines
902 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](https://angular.io/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 like `string`, `number`, `boolean`, and `Object`.
|
||
|
|
||
|
Use the [@Injectable](https://angular.io/api/core/Injectable) method or [@Inject](https://angular.io/api/core/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](https://angular.io/errors/NG0201).
|