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

Chemistry - Bond Angles In NH3 And NCl3

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Change The Font Size Of Visual Studio Solution Explorer