Skip to content

Instantly share code, notes, and snippets.

Created April 19, 2020 12:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save stefansheva/5131323a49c70433e3f5d4749ce285ce 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';
providedIn: 'root'
export class PageService {
constructor(private http: HttpClient) { }
getAllPages() {
return this.http.get(`${environment.apiUrl}/pages`).pipe(map(res => res));
getPage(pageId) {
return this.http.get(`${environment.apiUrl}/pages/${pageId}`).pipe(map(res => res));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment