0
I believe it’s simple, but coming out of Ionic 1 to 3 has changed so many things.
I need to take all my Json returns from this routine (I actually need the user ID and log in localstorage):
submit(){
var email = this.data.email;
var senha = this.data.senha;
var link = 'http://localhost/webapi/consultarEmailSenha.php?email='+email+'&senha='+senha;
//var myData = JSON.stringify({email: this.data.email}) + JSON.stringify({senha: this.data.senha});
console.log(link);
this.http.get(link)
.subscribe(data => {
this.data.response = data["_body"]; //https://stackoverflow.com/questions/39574305/property-body-does-not-exist-on-type-response
console.log(this.data.response[0]);
console.log(this.data.response[1]);
console.log(this.data.response[2]);
console.log(this.data.response[3]);
console.log(this.data.response[3]);
}, error => {
console.log("Oooops!");
});
The return of the Json is like this:
[{"idusuarios":"1","nome":"Ramos J","email":"[email protected]","celular":null,"telefone":"","data_nascimento":"1978-07-19","altura":null,"peso":null,"gordura":null,"vo2":null,"senha":"teste"}]
It worked @Nilsonuehara. I just changed a little: var array = JSON.parse(this.data.Response); array.foreach(element => { console.log(element.idusuarios); });
– Ramos