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 
]