Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Created April 17, 2020 21:10
Show Gist options
  • Save NyaGarcia/22d31ea2007dd8228b39e9aea17623e1 to your computer and use it in GitHub Desktop.
Save NyaGarcia/22d31ea2007dd8228b39e9aea17623e1 to your computer and use it in GitHub Desktop.
Observable created with ajax, data fetched with getJSON
import { ajax } from "rxjs/ajax";
// Observable will only emit the response data
const ghibliFilm$ = ajax.getJSON("https://ghibliapi.herokuapp.com/films");
ghibliFilm$.subscribe(films => console.log(films));
// Output: [Object, Object, Object...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment