July 2018
Intermediate to advanced
420 pages
8h 46m
English
Now, let's add the new error handling to the bikes service.
Open ./app/pages/bikes/_services/bike.service.ts and replace its contents with the following code:
import { Injectable } from '@angular/core'; import { HttpClient, HttpParams, HttpErrorResponse } from '@angular/common/http'; import { HttpHeaders } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; // App import import { environment } from '../../../../environments/environment'; import { Bike } from '../bike'; import { HttpErrorHandler, HandleError } from '../../../shared/_services/http-handle-error.service'; @Injectable({ providedIn: 'root' }) export class BikesService { private readonly ...Read now
Unlock full access