Guest User

Untitled

a guest
Dec 15th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. getHeroes (): Observable<Stuff[]> {
  2. return this.http.get(this.url)
  3. .map(this.extractData)
  4. .catch(this.handleError);
  5. }
  6.  
  7. import 'rxjs/add/operator/catch';
  8.  
  9. import {Observable} from 'rxjs/Rx';
  10.  
  11. import { Observable } from "rxjs/Observable";
  12. import { catchError } from 'rxjs/operators';
  13. ...
  14.  
  15. export class ExampleClass {
  16. constructor(private http: HttpClient) {
  17. this.http.request(method, url, options).pipe(map(res => res),
  18. catchError((err: HttpErrorResponse) => {
  19. ...
  20. }
  21. )
  22. }
  23. ...
  24. }
Add Comment
Please, Sign In to add comment