There are more operators in the filtering category besides filter(). This lesson will teach how take(), first(), and skip() are simply operators to ignore or pass a certain amount of events from the source Observable.
🚨 Since we are importing interval
from RxJS, we don't need to preface our Observables with Rx.Observable
. You can no longer .{operator}
, you need to .pipe({operator})
instead.
foo.first() and foo.take(1), are not equivalent, at least on an edge case.
If foo is an empty observable, foo.first() throws an EmptyError, while foo.skip(1) returns an observable equivalent to Observable.empty(). The former requires that you either provide a defaultIfEmpty or a .catch.
Correct, Andrew. Thanks for pointing it out!