NG2003: No suitable injection token for parameter

From Get docs
< Errors ListAngular/docs/11/errors/ng2003


NG2003: No suitable injection token for parameter

Description

There is no injection token for a constructor parameter at compile time. InjectionTokens are tokens that can be used in a Dependency Injection Provider.

Debugging the error

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 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.


© 2010–2021 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v11.angular.io/errors/NG2003