The Angular 2 Http service documentation includes a code example showcasing how to fetch data using the getHeroes function.
getHeroes (): Observable<Stuff[]> {
return this.http.get(this.url)
.map(this.extractData)
.catch(this.handleError);
}
After cloning the angular2-webpack-starter repository, I implemented the above code myself.
To use Observable
, I included the following import statement:
import {Observable} from 'rxjs/Observable';
I assumed that the necessary properties of Observable
are also imported as functions like .map
function work as expected. Upon checking the changelog for rxjs.beta-6 version, no mention was found regarding the catch
method.