This project has been archived. If you're curious, check out one of my latest courses:
If you work with JavaScript, check out the fetch use cases and JavaScript projects.
Thank you! — Jad Joubran
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
@Injectable()
export class PostsService {
constructor(private http: Http) {}
getAll(): Observable {
return this.http
.get('api/posts')
.map(response => response.json());
}
}