Skip to content

Instantly share code, notes, and snippets.

@stefansheva
Created April 19, 2020 12:37
Show Gist options
  • Save stefansheva/e49aaab4d650560d25408834d9996dd9 to your computer and use it in GitHub Desktop.
Save stefansheva/e49aaab4d650560d25408834d9996dd9 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../environments/environment';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ContentService {
constructor(private http: HttpClient) { }
getAllContents() {
return this.http.get(`${environment.apiUrl}/contents`).pipe(map(res => res));
}
getContent(contentId) {
return this.http.get(`${environment.apiUrl}/contents/${contentId}`).pipe(map(res => res));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment