Error in Http Module


#1

I tried building the ionic app and I recieve the following error.

[19:18:57]  typescript: C:/Users/MANAV/ionreddit/src/app/services/reddit.service
.ts, line: 11
            Cannot find name 'Http'.

      L11:      constructor(http:Http){

I did change the import {HttpModule} from ‘@angular/http’ in app.module.ts
and added HttpModule in import: [… ]

Can anyone help please :confused:


No provider for Http! error in ionic
#2

You should need add app.module.ts.

imports: [HttpModule]

regard.


#3

@rdlabo I already did this. It still gives the error


#4

Check if this line is there in your app.module.ts file
import { HttpModule } from '@angular/http';

Also do this after importing(in this sequence only)

imports:[
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp)
]

hope it works


#5

tried pubic http: Http ? And did you import it (not only added it to the imports) add app.module, since you only posted a prtial screenshot.


#6

I did all that . No luck :frowning:


#7

I think the answer is in the only usable information OP posted in the entire thread (in that it’s actually readable):

reddit.service.ts: Cannot find name 'Http'

So that tells me that there is no import for Http in reddit.service.ts.


#8

I think you’re the only one that really paid attention to that one :smile:


#9

I am sorry but the import for Http is already there.


#10

I hate it when people post screenshots of code. It’s lazy and selfish, because (among many other reasons) other people with similar problems can’t search and find advice given to you. That being said, you misspelled “@angular”, and if your IDE didn’t flag that, I would look for a better IDE.


#11

Oh shit :hushed:. Thank You