title: Data is available in .map() but not in .subscribe() - angular 5
body: <p>I am working on an angular 5 code. I have made an API call in serviceA as</p>
  <pre><code>public functionA{
    let url ='someURL'
    let body ={some params}
   return this.http.post(url, body).map((res: any) =&gt; {
             const data = res;
  
       }
  }
  </code></pre>
  <p>and I am able to get the data here.</p>
  <p>Now i need the same data in another componentB. and i subscribed to the function as follows:</p>
  <pre><code>this.serviceA.functionA.subscribe(data=&gt; console.log(data));
  </code></pre>
  <p>But here in component B , I am not able to get the data. it is undefined.</p>
  <p>Im on angular version 5.2. Could someone please let me know on what I am doing wrong.</p>