Get angular Observable stream as array

前端 未结 3 2144
清酒与你
清酒与你 2021-02-14 09:52

I have list, that should simulate the stream :

list = [
  {name : \'Str1\', age: 10},
  {name : \'Str2\', age: 10},
  {n         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-14 10:47

    I think this is more appropriate solution:

    Observable.of(this.list).map(x => x.slice(this.currentPage * this.pageSize)).map(x => x.slice(0, this.pageSize)).subscribe(data => this.pagerList = data, console.error);
    

提交回复
热议问题