i get no error but no status either.I think things got worse…
Please why is this so hard to achieve a Http response?https://github.com/NikolaosBenakis/HttpRequest-to-WebService-Api-with-Parameters/tree/master/src
Above link contain my whole src code.
I coded —> pages/home/Home.ts
providers/loginservice/loginservice.ts
import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import {LoginserviceProvider} from “…/…/providers/loginservice/loginservice”;
@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
params:{
SubscriptionPassword: string;
UserID: string;
UserPassword: string;
BranchID: string;
AllowHttp: boolean;
};
constructor(public navCtrl: NavController,
private loginserviceprovider: LoginserviceProvider) {
}
ionWillEnter() {
let url = ‘http://192.168.0.6:81/EBSWebApi’;
this.params = {
SubscriptionPassword: “passx”,
UserID: “khcadmin”,
UserPassword: “00100100957”,
BranchID: “01”,
AllowHttp: true
};
let options = {};
this.loginserviceprovider.getResponse(url,this.params,options)
.subscribe(data=>{
console.log(data);
});
}
}
import { HttpClient } from ‘@angular/common/http’;
import { Injectable } from ‘@angular/core’;
import ‘rxjs/add/operator/map’;
import {Observable} from “rxjs/Observable”;
@Injectable()
export class LoginserviceProvider {
url;
params ={ SubscriptionPassword: “passx”,
UserID: “khcadmin”,
UserPassword: “00100100957”,
BranchID: “01”,
AllowHttp: true
};
constructor(public http: HttpClient) {
console.log(‘Hello LoginserviceProvider Provider’);
this.url =“http://192.168.0.6:81/EBSWebApi”;
}
public getResponse(url:string,params?:any, options:any ={}):Observable{
// options.params =this.params;
// options.withCredentials=true;
return this.http.get(this.url+params+options);
}
}