HttpModule does not have property 'get'!

I have imported the HTTP module

import { HttpModule } from ‘@angular/http’;

but on trying to use it:

public myHttp: HttpModule …

this.myHttp.get( '…

I get this error:

‘Property ‘get’ does not exist on type ‘HttpModule’.’

Is something missing?

Thanks
JC

The HttpModule needs to be set up as an import in your app.module.ts file. It is Http that you want to inject in order to make a GET request.

Thanks for your reply.

I have the line

import { HttpModule } from ‘@angular/http’;

in app.module.ts

Not sure what you mean by
" It is Http that you want to inject in order to make a GET request."

JC

The rest of the Angular docs are great too.

1 Like

I have followed your tutorial to perform this. It still gives me the same error.
Tutorial link

The important distinction is to import:

import { HttpModule } from ‘@angular/http’;

in

app.module.ts

and

import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’

in your page.

The first imports HttPmodule; the second imports Http.

JC