@Injectable()
export class SearchService {
...
return this.http.get(`https://api.spotify.com/v1/dsds?q=${term}&type=artist`)
.map(response => response.json())
.catch(e => {
if (e.status >== 500) {
return cachedVersion();
return Observable.throw(
new Error(`${ e.status } ${ e.statusText }`)
);
}
});
}