Ionic 2 real working example of restful api ajax post?

Hi, I’m been searching for days to write a piece of code to extract data from api or any sort of, but not finding a working one, I’m always encounter error the module not found (this error very easy come out if just a little bit wrong), blah blah undefined etc, seriously I’m like solving a code puzzle, anyway my code like this, so I’m sure something wrong somewhere but I’m not sure where it is:

import {Page, Injectable, Http, Headers, RequestOptions} from ‘ionic-angular’;
import {Observable} from ‘rxjs/Observable’;
import ‘rxjs/Rx’;

@Page({
templateUrl: ‘build/pages/login/login.html’
})
export class LoginPage {
static get parameters() {
return [[Http], [Headers],[RequestOptions]];
}

constructor (http, headers, options) {

}

Authenticate(usr, pwd) {
//let url = ‘http://localhost:85/SIAEC/api/DefectReportingService.aspx/Authenticate’;
//let body = JSON.stringify({ usr: usr, pwd: pwd });
//let headers = new Headers({ ‘Content-Type’: ‘application/json; charset=utf-8’ });
//let options = new RequestOptions({ headers: headers });
//return this.http.post(url, body, options)
// .map(res => res.json())
// .catch(this.handleError);

//handleError(error) {
//    console.error(error);
//    return Observable.throw(error.json().error || 'Server error');
//}

}

}

1 Like