getData(id : number) : Observable<Post> {
    return this.http.get(
${this.requestUrl}/${id}
)       .map(this.mapResponse)       .catch(this.handleError)   }   handleError(error: any): Observable<any> {     console.error('An error occurred', error);     return Observable.throw(error.json() || 'Server error');   }
The catch reference is there to handle exceptions that are thrown. This gives you an opportunity to handle them in a graceful manner.
All rx operations return an observable.
Comments