Problem at http request to a rest api in ionic 2


#1

I encountered a problem to http request a rest api in ionic 2.

Here is my code:

this.http.get('http://localhost:3000/news').subscribe(res => {
  this.data = res.json()
  console.log(res)
})          

But got the follow error message

Can anybody advise? Thanks.


#2

Try the Rxjs map to map the res.json() before the subscribe.