I am new to Ionic framework and Angular2. I am unable to send post request to the server. I can't figure out what thing I am missing.
My App code:
import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import {Camera} from 'ionic-native'; import { Http, Headers, HTTP_PROVIDERS } from 'angular2/http'; import 'rxjs/Rx'; @Component({ selector: 'page-upload', templateUrl: 'upload.html' }) export class UploadPage { public base64Image: string; array = Array<any>; loading: boolean; constructor(public navCtrl: NavController,public http: Http) { } takePicture(){ Camera.getPicture({ destinationType: Camera.DestinationType.DATA_URL, targetWidth: 1000, targetHeight: 1000 }).then((imageData) => { // imageData is a base64 encoded string this.base64Image = "data:image/jpeg;base64," + imageData; }, (err) => { console.log(err); }); } accessGallery(){ Camera.getPicture({ sourceType: Camera.PictureSourceType.SAVEDPHOTOALBUM, destinationType: Camera.DestinationType.DATA_URL }).then((imageData) => { this.base64Image = 'data:image/jpeg;base64,'+imageData; }, (err) => { console.log(err); }); } makePostRequest() { this.http.get('https://public-api.wordpress.com/rest/v1.1/freshly-pressed/').subscribe(data => { }); } } When I compile the app for android I get the following error:
L16: constructor(public navCtrl: NavController,public http: Http) { Cannot find name 'Http'.