Property 'http' does not exist on type 'MyProvider'


I’m new to ionic 2 and angular and trying ultimately to create a json call to my backend service. I have the following code:

import {Injectable, Inject} from '@angular/core';
import {Http} from '@angular/http';


export class MyProvider {
    constructor(http: Http) {
        this.http = http;


…but in my IDE it’s saying "property http does not exist on type ‘MyProvider’. Can someone tell me why it says that?

If i add the “private” word in the constructor the error goes away. As in:

  constructor(private http: Http) {
        this.http = http;


My ionic info:
Cordova CLI: 4.3.1
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
Node Version: v4.5.0

That’s how TypeScript works. If you add an access qualifier (private or public) to a constructor parameter, a property with the same name is automatically added to the class and initialized properly. You don’t even need to have the assignment line in your constructor.

@mrobinson I would recommend you this article: Top 10 Things to Know about TypeScript.

Will do, thanks for the link @iignatov