Skip to content

Instantly share code, notes, and snippets.

@langan
Last active May 29, 2018 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save langan/abdba3339422c41a624cee047acf02bd to your computer and use it in GitHub Desktop.
Save langan/abdba3339422c41a624cee047acf02bd to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class WordpressService {
constructor(private http: HttpClient) { }
getPosts(): Observable<any[]> {
return this.http.get<any[]>('http://www.oxygenna.com/wp-json/wp/v2/posts?_embed', {
params: {
per_page: '6'
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment