Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Inside the constructor http is undefined

$
0
0

@Daikinzan wrote:

created a simple component to get data

example code:
import {Http} from 'angular2/http';

export class Data {

static get parameters() {
    return [[Http]];
}

constructor(http) {

    **// http is undefined from here**

    this.http = http;

   this.jsonData = this.http.get('http://jsonplaceholder.typicode.com/posts').map(res => res.json());
   console.log(this.jsonData)
}

}

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>