Rx.Observable.prototype.switch()

Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. There is an alias for this method called switchLatest for browsers <IE9.

Returns

(Observable): The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.

Example