Skip to content

Instantly share code, notes, and snippets.

@Christopher2K
Created April 9, 2018 21:33
Show Gist options
  • Save Christopher2K/4ebddc694ce43aaeb94152cc8d76ac98 to your computer and use it in GitHub Desktop.
Save Christopher2K/4ebddc694ce43aaeb94152cc8d76ac98 to your computer and use it in GitHub Desktop.
// with [email protected] & [email protected]
import { ajax } from 'rxjs/observable/dom/ajax';
import { tap } from 'rxjs/operators';
const request = ajax.getJSON('http://myurl.com/data')
.pipe(
tap((jsonData) => console.log(jsonData))
);
// Appel HTTP
request.subscribe(
(jsonData) => {
alert('SUCCESS !!');
console.log(jsonData);
},
(err) => {
alert('ERROR !!');
console.error(err)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment