Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { ICar } from './ICar';
- import { Injectable } from '@angular/core';
- import { HttpClient } from '@angular/common/http';
- import { Observable } from 'rxjs';
- import { map} from 'rxjs/operators';
- @Injectable({
- providedIn: 'root'
- })
- export class CarsService {
- constructor(private http: HttpClient) {
- }
- getCars(): Observable<ICar[]> {
- return this.http.get('./app/cars.json')
- .pipe(map((resp: Response) => resp.json().data));
- }
- }
Add Comment
Please, Sign In to add comment