StaticInjectorError – NullInjectorError: No provider for {ServiceClass}

Angular throws a StaticInjectorError, when you try to do dependency injection as below:

To fix this you can add the metadata “Provider” inside the component decorator.   Or you can always go to the relevant module and register all the components dependencies in the provider meta tag there.
Continue reading...