The of()
operator essentially converted a list of arguments to an Observable. Since arrays are often how we structure list of things in JavaScript, we should have a way of transforming arrays into Observables.
This lesson teaches how you can convert from Arrays to Observables, from Promises to Observables, and from Iterators to Observables. We will look at the API RxJS has for doing that: from
, fromPromise
, and fromArray
.
It looks like fromArray() has been deprecated.
Hi Steve, that is correct. The API fromArray() is not directly available, but one can still use from() which auto-detects what kind is the argument (array, Promise, etc) and under the hood may use fromArray or fromPromise, etc.