Skip to content Skip to sidebar Skip to footer

Angular 5 StaticInjectorError:[Http]

hello i am getting such an error what is the reason for this? StaticInjectorError[Http]: StaticInjectorError[Http]: NullInjectorError: No provider for Http! at NullInjector.get (co

Solution 1:

Try to import HttpClientModule in your app.module.ts

import { HttpClientModule } from '@angular/common/http'; 

Solution 2:

Import the HttpClientModule in the app.module.ts as mentioned in the example. Thanks World! :)

 import { HttpClientModule } from '@angular/http';

        @NgModule({
            imports: [ BrowserModule, HttpClientModule ],
            providers: [],
            declarations: [ AppComponent ],
            bootstrap: [ AppComponent ]
        })
        export default class AppModule { }

        platformBrowserDynamic().bootstrapModule(AppModule); 

Solution 3:

enter image description here

You didn't import HttpModule in (maybe you app.module.ts) in NgModule > imports


Post a Comment for "Angular 5 StaticInjectorError:[Http]"