Hi im using @ionic-native/http to make http request in my ionic app, i’m able to retrieve the respond from my web api, but i’m still not able to use the data to populate my list, i check the data from view and respond is not null, so why i still dont get the list ?
here is my code
import {Component} from '@angular/core';
import {Http} from "@angular/http"
import {Geolocation} from '@ionic-native/geolocation';
import {HTTP} from '@ionic-native/http'
@Component({
selector:'person-home',
templateUrl: 'person.html'
})
export class PersonPage{
item: any ;
constructor(public http : HTTP){
}
ionViewWillEnter(){
let body = {
"Param" :"param1",
"Param" :"param2"
}
let headers = {
'Content-Type': 'application/json'
};
this.http.post('http://test.com' ,body ,headers )
.then(res => {
this.item = res.data;
alert(res.data);
}
)
.catch(err =>{
alert(err)
}
);
}
}
and here is my html file
<ion-header>
<ion-navbar>
<ion-title>
Person
</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list inset>
<h2>{{item.parmPurchReqId}}</h2>
<p>{{item.parmPurchReqName}}</p>
</ion-list>
</ion-content>
and my json
[
{
"parmPurchReqId": "PR-000000331",
"parmPurchReqName": "RIKSA"
},
{
"parmPurchReqId": "PR-000000332",
"parmPurchReqName": "RIKSA"
}
]
Can you tell me what is wrong in here ? why my list still not appear
Thanks in Advance