Reputation: 355
someone can tell me where is the problem.
code stresses on json.
getPost(){
this.postService.getAll()
.subscribe(
response=>{
this.posts=response.json();
},error=>{
alert('error innattendue')
console.log(error)
}
);
}
Upvotes: 0
Views: 296
Reputation: 1
this.posts=response; Use like this. This will resolve your issue.
Upvotes: 0
Reputation: 722
Response should be json that you need, so if you directly use response it should work
getPost(){
this.postService.getAll()
.subscribe(
response=>{
this.posts=response;
},error=>{
alert('error innattendue')
console.log(error)
}
);
}
Upvotes: 2