I am facing a problem with injecting HTTP into my Angular 2 application. Everything was working smoothly a few days ago, but now I am encountering this error:
ORIGINAL EXCEPTION: No provider for Http!
Here is the code snippet from main.ts:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
import { LoginModule } from "./login/login.module";
import { Http } from "@angular/http";
platformBrowserDynamic().bootstrapModule(LoginModule);
Code from login module.ts:
@NgModule({
imports: [BrowserModule, FormsModule], // external modules for all components
declarations: [LoginComponent], // component which belong to this module
bootstrap: [LoginComponent] // component on load
})
export class LoginModule {
}
And here's the LoginComponent code in LoginModule:
import { Component } from '@angular/core';
import { AccountService } from "../data/account.service";
import { Http, Response, RequestOptions, Headers } from '@angular/http';
import { LocalStorage } from '../storage/storage';
@Component({
selector: 'tp-login',
templateUrl: `app/login/login.html`,
styleUrls: ['app/login/login.css'],
providers: [AccountService, LocalStorage]
})
The exception in LoginComponent pertains to the lack of an HttpProvider. Can anyone suggest a solution to resolve this issue?