How to return data coming from response instead of subscription json in Angular 2/4

Viewed 8762

My Service :

fetchData(url,request)
  {
    return this.http.post(this.apiUrl+url,request).subscribe(
        (response) => {return response.json()}
    );
  }

My Component :

ngOnInit()
    {
        this.response = this.dataService.fetchData('friends/grow_network',{});
        console.log('s ',this.response);
    }

if I console response.json() in service it shows proper data which is coming from api but if I console in component it shows like this :

Subscriber {closed: false, _parent: null, _parents: null, _subscriptions: Array(1), syncErrorValue: null…}

how to get data in component which is coming from api not Subscriber data ?

2 Answers
Related