No provider for Http! error in ionic

thanks bro…
thank q sooooo much…

Even after changing the import in app.module.ts I still receive the error. :confused:

@riteshbhat17

1 Like

can you provide the code which use have for the provider and app.module.ts here…

Do you run Ionic 2.0 or 3.0?

@riteshbhat17 Sure…

Yor app.module.ts should look like this in Ionic 3.X

...
import { HttpModule } from '@angular/http';

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

And then you can import the Http Module in your provider

import { Http } from '@angular/http';
....
constructor(private http: Http) { }

You can follow my Ionic 3 guide here: Guide: How to update to Ionic 3.X

8 Likes

Component? Not module?

Ups :open_mouth: I changed it

Thanks You @joshmorony,

It’s work perfectly after added

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

and

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

thanks for your solution, but after including httpModule am getting below error

Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using ‘barrel’ index.ts files.

Please help me

Thanks, man, you saved my day!

Very Good! Congratulations, all likes the your posts.

Thank Josh, you saved me a ton of time and frustration! :slight_smile:

Next drink is on me :wink:

thank you very much! saved my life :slight_smile:

TY for all your Ionic help… The world is better with this :sunny:

Thanks alot Yahoooooo <3

Thank you @joshnash :slight_smile:

@joshmorony for president :raised_hand_with_fingers_splayed:t5::grimacing:

Worked!!!

Thank you Josh!

Great men, thanks, it worked for me