I have list, that should simulate the stream :
list = [
{name : 'Str1', age: 10},
{name : 'Str2', age: 10},
{name : 'Str3', age: 10}
];
and I've created an Observable
from this list:
Observable.from(this.list).skip(this.currentPage * this.pageSize).take(this.pageSize).subscribe(data => this.pagerList = data, console.error);
And in the subscribe method I get the values one by one. How I'm supposed to wait for the whole data to be returned and then to get the whole list. There is take() operator, and after it the Observable have to stop.
I don't want to put every value one by one in the array.
I'm new here, not only for angular, but for javascript as well.
Have you tried to use
toArray
operator?.I think this is more appropriate solution:
The
scan
operator should do what you wanthttp://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-scan