-2

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 ..?

5
  • No shortage of docs on how to use Http in Angular: angular.io/guide/http Commented Mar 24, 2019 at 11:16
  • import HttpClientModule like import { HttpClientModule } from '@angular/common/http' Commented Mar 24, 2019 at 11:18
  • Also if you are brand new I suggest to start with lot simpler stuff first. Commented Mar 24, 2019 at 13:21
  • robert can you advise me which video course is good for me ? Commented Mar 24, 2019 at 13:52
  • @გენომუმლაძე Try this Commented Mar 24, 2019 at 18:05

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.