Angular 5, NullInjectorError: No Provider For Service


Answer :

You need to add TesteventService under providers under imports in your app.module.ts

providers: [   TesteventService  ] 

Annotate your service class with -

@Injectable({ providedIn: 'root' }) 

The service itself is a class that the CLI generated and that's decorated with @Injectable(). By default, this decorator has a providedIn property, which creates a provider for the service. In this case, providedIn: 'root' specifies that Angular should provide the service in the root injector.


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?