{"id":527,"hash":"c3e29b2156f4a22f79316dd3b8cad5a84f26dc313221200d17beac4f7f4e130a","pattern":"Angular EXCEPTION: No provider for Http","full_message":"I am getting the EXCEPTION: No provider for Http! in my Angular app. What am I doing wrong?\n\nimport {Http, Headers} from 'angular2/http';\nimport {Injectable} from 'angular2/core'\n\n@Component({\n    selector: 'greetings-ac-app2',\n    providers: [],\n    templateUrl: 'app/greetings-ac2.html',\n    directives: [NgFor, NgModel, NgIf, FORM_DIRECTIVES],\n    pipes: []\n})\nexport class GreetingsAcApp2 {\n    private str:any;\n\n    constructor(http: Http) {\n\n        this.str = {str:'test'};\n\n        http.post('http://localhost:18937/account/registeruiduser/',\n            JSON.stringify(this.str),\n            {\n                headers: new Headers({\n                    'Content-Type': 'application/json'\n                })\n            });","ecosystem":"npm","package_name":"angular","package_version":null,"solution":"Import the HttpModule\n\nimport { HttpModule } from '@angular/http';\n\n@NgModule({\n    imports: [ BrowserModule, HttpModule ],\n    providers: [],\n    declarations: [ AppComponent ],\n    bootstrap: [ AppComponent ]\n})\nexport default class AppModule { }\n\nplatformBrowserDynamic().bootstrapModule(AppModule);\n\nIdeally, you split up this code in two separate files.\nFor further information read:\n\nhttps://v2.angular.io/docs/ts/latest/cookbook/rc4-to-rc5.html\nhttps://v2.angular.io/docs/ts/latest/guide/ngmodule.html","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/33721276/angular-exception-no-provider-for-http","votes":351,"created_at":"2026-04-19T04:51:17.803666+00:00","updated_at":"2026-04-19T04:51:17.803666+00:00"}