Reputation: 447
I have this code:
Rx.Observable.from([1,2,3,4,5,6])
.subscribe(x=>console.log(x));
How can I return an array from subscribe instead of the subscribe iterating through the array elements from the .from() method?
I want the x argument to be an array and to console.log() this array.
Upvotes: 1
Views: 868
Reputation: 1
Or, pass it like this:
Rx.Observable.from([[1,2,3,4,5,6]]);
an array whose first element is an array.
Upvotes: 0
Reputation: 2404
ReactiveX has the "to" operator, which can be used with RxJS as toArray
:
http://reactivex.io/documentation/operators/to.html
Rx.Observable.from([1,2,3,4,5,6])
.toArray()
.subscribe(x=>console.log(x));
Upvotes: 1