RxJS Functions (Part 7)
2 min readJan 14, 2019
from
from
Creates an Observable from an Array, an array-like object, a Promise, an iterable object, or an Observable-like object.
TL;DR
Creates an Observable in several different ways. If you want to make your own Observable, see if you can use from
first before calling the Observable constructor.
Use Case
The StackBlitz above best illustrates the various uses of from
. It creates three Observables:
- One from an iterator
- One from an array-like object
- One from a Promise
It then concats all of those to produce the animation above.
Thanks for reading. Stay tuned for Part 8, and be sure to checkout my previous articles.