I am currently linking a bunch of http requests, however there are problems handling 404 errors before subscribing.
My code is:
in the template:
...
service.getData().subscribe(
data => this.items = data,
err => console.log(err),
() => console.log("Get data complete")
)
...
in service:
...
getDataUsingUrl(url) {
return http.get(url).map(res => res.json());
}
getData() {
return getDataUsingUrl(urlWithData).flatMap(res => {
return Observable.forkJoin(
res.map(
e => getDataUsingUrl(anotherUrlWithData)
)
)
}).map(res => {
values = doStuff(res);
return values;
})
}
source
share