import { Injectable } from '@angular/core' ; import { Response } from "@angular/http" ; import { Observable } from "rxjs" ; @ Injectable ( ) export class ApiResponseService { constructor ( ) { } extractApiResponse ( response ) { return response . json ( ) ; } extractApiError ( response ) { console . log ( response ) ; let resp = response . json ( ) ; console . log ( resp ) ; return Observable . throw ( resp ) ; } }