i am new in angular world. i trying to learn this framework but it is so HARD!... so in my first example i got error:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
and the error is :
Failed to compile.
./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http' in 'C:\Hosts\ng4tutorial\src\app'
what I missed ..?
Check your angular : ng --version
Please note that Http was deprecated in the version 4.3 of Angular.
If you have a newer version i recommend to you to use the new Api : HttpClient which came with many updates and support for progress events, json deserialization by default, Interceptors and many other great features.
See how to use it and more here https://angular.io/guide/http