from
``# from
signature: from(ish: ObservableInput, mapFn: function, thisArg: any, scheduler: Scheduler): Observable
Turn an array, promise, or iterable into an observable.
💡 This operator can be used to convert a promise to an observable!
💡 For arrays and iterables, all contained values will be emitted as a sequence!
💡 This operator can also be used to emit a string as a sequence of characters!
Examples
Example 1: Observable from array
( StackBlitz | jsBin | jsFiddle )
Example 2: Observable from promise
( StackBlitz | jsBin | jsFiddle )
Example 3: Observable from collection
( StackBlitz | jsBin | jsFiddle )
Example 4: Observable from string
( StackBlitz | jsBin | jsFiddle )
Related Recipes
Additional Resources
from 📰 - Official docs
from - In Depth Dev Reference
Creation operators: from, fromArray, fromPromise 🎥 💵 - André Staltz
📁 Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/from.ts
Last updated