angular 2 how to return data from subscribe
<p>This is What I Want To Do.</p>

<pre><code>@Component({
   selector: "data",
   template: "&lt;h1&gt;{{ getData() }}&lt;/h1&gt;"
})

export class DataComponent{
    this.http.get(path).subscribe({
       res =&gt; return res;
    })
}
</code></pre>

<p>If <code>getData</code> was called inside the <code>DataComponent</code>, You may suggest assign it to a variable like <code>this.data = res</code> and use i like <code>{{data}}</code>.But I needed to use like <code>{{getData}}</code> for my own purpose.Please suggest me?</p>