Can you try like this?
loadData(){
let data : any;
data = this.http.get(‘https://jsonplaceholder.typicode.com/posts/’);
data.subscribe(result:any => {
this.items=result;
})
}
Can you try like this?
loadData(){
let data : any;
data = this.http.get(‘https://jsonplaceholder.typicode.com/posts/’);
data.subscribe(result:any => {
this.items=result;
})
}
Please ignore the previous post. Emulating pretty much anything in it will make your code worse.
thanks but i already tried it
loadData(){
let data : any;
data = this.http.get(https://jsonplaceholder.typicode.com/posts/)
.map(res=>{
res.json()
});
data.subscribe(result:any => {
this.items=result;
})
}
Please try this and let me know the response
data is displaying on console but how to display on page ? how binding can be done ?
Add the response to an array. Then bind