Angular 2 polling with RxJS

You need to use switchMap(), there's no flatMapLatest() in RxJS 5.

See Migrating from RxJS 4 to 5... Although docs aren't very clear about switchMap()...

Returns a new Observable by applying a function that you supply to each item emitted by the source Observable that returns an Observable, and then emitting the items emitted by the most recently emitted of these Observables.


To explain @Sasxa 's answer a bit more.

SwitchMap in illustration. (from http://reactivex.io/documentation/operators.html)

enter image description here