Last active
March 18, 2016 14:21
-
-
Save jamesmorgan/39070a449266db247edd to your computer and use it in GitHub Desktop.
using advanced RxJs suscriber features
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
// You must import this or the actual feature you require form rxjs to use things like delay(), map(), retry() | |
import 'rxjs/Rx'; | |
... | |
export class Test { | |
constructor(private _http:Http) { | |
_http.get('http://localhost:8080/competitions') | |
.map(res => res.json()) // map to json | |
.delay(2000) // atrificially delay the | |
.retry(3) // attempt to retry x number of times | |
.subscribe( | |
... | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment