Last active
September 29, 2018 17:10
-
-
Save jagomf/68ec2693db26a54096e025ebb13b66c9 to your computer and use it in GitHub Desktop.
Alternate method of returning a subscription in an Angular service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getResultFromRemote(): Subject<string> { | |
const subs = new Subject<string>(); | |
this.http.get('http://localhost/service') | |
.subscribe((res) => { | |
subs.next(res); | |
}, (err) => { | |
subs.error(res); | |
}); | |
return subs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment