父类
import { BadRequestError } from './../common/bad-request-error';
import { NotFoundError } from './../common/not-found-error';
import { AppError } from './../common/app-error';
import { Http } from '@angular/http';
import { Injectable, OnInit } from '@angular/core';
import { catchError } from 'rxjs/operators';
import { throwError} from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class DataService {
constructor(private url: string , private http: Http) {
}
getAll() {
return this.http.get(this.url).pipe(catchError(this.handleError));
}
delete(id) {
return this.http.delete(this.url + '/' + id)
.pipe(
catchError(this.handleError));
}
update(resource) {
return this.http.patch(this.url …Run Code Online (Sandbox Code Playgroud)