Yogesh Chauhan's Blog

Solution to “NullInjectorError: No provider for module” in Angular 9

in Angular on May 16, 2020

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 {}

Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
How to load variables, functions, and mixins from another module in SCSS?SCSSHow to use @if and @else in SCSS?SCSSLearn how to use Self JOIN in SQL and MySQLSQL/MySQLWordPress: How to display slider repeater fields in ACF?WordPressHow to create a CSS full page background image?CSSWhat’s the difference between visibility: hidden and display: none?CSSHow to show and hide an element on click in React?ReactWordPress: How to print ACF array field values?WordPressCan we execute conditions in SQL?SQL/MySQLThe basics of @import rule in SCSS (Sass)SCSSSequence generator (range) using JavaScript Array.from()JavaScriptCan Firewall and IDPS Stop DDoS Attack?Miscellaneous