Error: No provider for Http!

I made this provider for my app.

import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';

export class UserProvider {

  Theme: {color: string};
  info: Info;
  constructor(public http: Http) {
    console.log('Hello UserProvider Provider');
    this.Theme.color = "primary"; = "test"; = "xx/xx/xxxx"; = "XX:XX"; = ""; = "SomeCity";

  getInfo() {

  getTheme() {
    return this.Theme;


interface Info {
  name: string;
  dob: string;
  tob: string;
  email: string;
  city: string;

I am trying to use it here like this:

  constructor(public navCtrl: NavController, public navParams: NavParams, public user: UserProvider) {
    this.Theme = this.user.getTheme();

The app doesn’t load and shows this error:

I tried adding it in the providers list in app.module.ts but then it showed no provider for backend error.
What do I do? Please thanks.


1 Like


Please see this thread: Uncaught (in promise): Error: No provider for Http

Could you please confirm that you import HttpModule in app.module.ts?

1 Like

You search the forums for your error message and find a bunch of threads like this one that tell you to take Http out of your app module’s providers.

No I didn’t but now I did and it worked! :slight_smile:
Thank you but could you please explain why I need to do that?

Thanks!! It works for me.