This error occurs in Angular when you create a singleton service and implement them in your component:

main.js:1 ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(i)[i -> i -> i -> i -> i]: NullInjectorError: No provider for i!

Solution

You need to add the service under "providers" in your app.module.ts

providers: [
  MyService 
]

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!