Check value inside get response


#1

Hi,

I’m using ionic 3 and i’d like to know how make a var_dump (like php) from a get response in function Get AllUsers

Here is my provider:

import { HttpClient } from ‘@angular/common/http’;
import { Injectable } from ‘@angular/core’;

/*
Generated class for the UserProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class UserProvider {
http: HttpClient;
response: any;
apiURL: string = “http://resteasyshop.be/userrestservice.svc”;

constructor(public http_: HttpClient) {
console.log(‘Hello UserProvider Provider’);
this.http = http_;
}

getAllUsers() {
var url = this.apiURL + “/GetAllUser”;
//this.http.get(url).subscribe(data => { this.response = data;});
new Promise(resolve => {
this.http.get(url).subscribe(data => {
resolve(data);
this.response = data;
console.log(“data:” + data);
}, err => {
console.log(“error:”+err);
});
});
//console.log(this.response);
return this.response;
}
}

Here is what i have in the response of webservice when i browse in IE

{“GetAllUserResult”:[{“City”:“Liege”,“Email”:“carcela.Lindsay@gmail.com”,“Firstname”:“Lindsay”,“IsAdmin”:false,“Lastname”:“carcela”,“Mobile”:“0498/987654”,“Password”:“123456”,“Phone”:"",“Street”:“avenue jean ernotte 7”,“UserID”:2,“Zipcode”:“4000”},{“City”:“liege”,“Email”:“dupontfab@gmail.com”,“Firstname”:“fabian”,“IsAdmin”:false,“Lastname”:“dupont”,“Mobile”:“0498/123456”,“Password”:“123456”,“Phone”:"",“Street”:“avenue jean ernotte 7”,“UserID”:1,“Zipcode”:“4000”}]}