Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getHeroes (): Observable<Stuff[]> {
- return this.http.get(this.url)
- .map(this.extractData)
- .catch(this.handleError);
- }
- import 'rxjs/add/operator/catch';
- import {Observable} from 'rxjs/Rx';
- import { Observable } from "rxjs/Observable";
- import { catchError } from 'rxjs/operators';
- ...
- export class ExampleClass {
- constructor(private http: HttpClient) {
- this.http.request(method, url, options).pipe(map(res => res),
- catchError((err: HttpErrorResponse) => {
- ...
- }
- )
- }
- ...
- }
Add Comment
Please, Sign In to add comment