Skip to content

Instantly share code, notes, and snippets.

@oddlyfunctional
Created October 5, 2016 22:47
Show Gist options
  • Save oddlyfunctional/8a02f8f9f5b8109224ec103d4e3d2a50 to your computer and use it in GitHub Desktop.
Save oddlyfunctional/8a02f8f9f5b8109224ec103d4e3d2a50 to your computer and use it in GitHub Desktop.
http.get('/first_resource')
.map(response => response.json())
.flatMap(firstResource => {
if (firstResource.someProperty) {
return http.get(`/first_resource/${firstResource.id}/second_resource`);
} else {
return Observable.never();
}
}).subscribe(handleSecondaryResource);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment