The error occurs because of missing providers in app.module.ts
The error mostly occurs when we try to change one of the services and class and forget to update the providers in the app.module
Just add the missing providers and the error will go away.
Look at this code:
@NgModule({
imports: [
BrowserModule,
...OtherModules...
],
providers: [blah..blah...blah], //<-- add your missing providers here
bootstrap: [ AppComponent ]
})
export class AppModule {}
Angular 9 error Modules NgModule solution