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:

  imports: [

  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 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

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 CREATE TABLE in SQL with and without using Another Table?SQL/MySQLHow to create a Recent Posts function in WordPress?WordPressIs there a way to do a FULL OUTER JOIN in MySQL?SQL/MySQLHow to get start index and end index (as int) of substring in Swift?SwiftPHP arrays for US states’ full names and abbreviationsPHPHow to make a curtain slider using jQuery and CSS?CSSHow destructuring works in React?ReactAdvanced nesting in Sass (SCSS) using at-rootSCSSWordPress: How to set WP_SITEURL?WordPressHow to get Current Year, Month and Date in JavaScript?JavaScriptWordPress: How to loop through ACF group fields?WordPressHow to use PHPMailer to send an Email via Gmail SMTP Server?PHP