Unfortunately as I was storing many results on the service, I'm now stuck with many {{myservice.somevalue}}
(and myservice.someother
) etc. sprinkled over my other components.
I believe it would be nicer to return from the service to a component.
This is the code that I have on the service:
getIssue(issueName: string) {
return this.http.post(this.URL + 'issue/all', JSON.stringify({'issueName': issueName}))
.subscribe(data => this.somevalue = data.json(),
err => console.log(err));
}
So then on several other components I call functions like this.myservice.getIssue(issueName)
.
In the HTML I'd prefer to use {{somevalue}}
.
What can I do to return a http observable from the http service?