Guest User

Untitled

a guest
Dec 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import { ICar } from './ICar';
  2. import { Injectable } from '@angular/core';
  3. import { HttpClient } from '@angular/common/http';
  4. import { Observable } from 'rxjs';
  5. import { map} from 'rxjs/operators';
  6.  
  7.  
  8. @Injectable({
  9. providedIn: 'root'
  10. })
  11. export class CarsService {
  12.  
  13. constructor(private http: HttpClient) {
  14.  
  15. }
  16. getCars(): Observable<ICar[]> {
  17. return this.http.get('./app/cars.json')
  18. .pipe(map((resp: Response) => resp.json().data));
  19. }
  20. }
Add Comment
Please, Sign In to add comment