angular 2 how to return data from subscribe
59
This is What I Want To Do.
@Component({
selector: "data",
template: "<h1>{{ getData() }}</h1>"
})
export class DataComponent{
this.http.get(path).subscribe({
res => return res;
})
}
If getData was called inside the DataComponent, You may suggest assign it to a variable like this.data = res and use i like {{data}}.But I needed to use like {{getData}} for my own purpose.Please suggest me?