Created
April 9, 2018 21:33
-
-
Save Christopher2K/4ebddc694ce43aaeb94152cc8d76ac98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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