Convert JavaScript Values to RxJS Observables

Share this video with your friends

Send Tweet

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.

Steve Cordrey
Steve Cordrey
~ 8 years ago

It looks like fromArray() has been deprecated.

André Staltz
André Staltz(instructor)
~ 8 years ago

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.