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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.