why http request respose is not display in angular 2?

41 views Asked by At

I am trying to use http in angular 2 .I make a service and call service from component .But I am didn't get response in component why ?

here is my code https://plnkr.co/edit/YBjCGtuxPdniZ8WEngm2?p=preview

moveToSecond(){
    this.main.getData().subscribe(p =>{
     console.log('test');
     console.log(p)
    })

Secondly

how to handle error in angular js

1

There are 1 answers

2
Günter Zöchbauer On BEST ANSWER

Change

return body.data || { };

to

return body || { };