How can I append items to Observable

后端 未结 3 457
甜味超标
甜味超标 2020-12-16 10:57

How do I append items to Observable?

This is some code:

 this.logEntries = this.controllerService.getLog(this.controller.remoteID, this.         


        
3条回答
  •  眼角桃花
    2020-12-16 11:34

    Perhaps the scan operator could interest you. Here is a sample:

    obs.startWith([])
     .scan((acc,value) => acc.concat(value))
     .subscribe((data) => {
       console.log(data);
     });
    

    See this question for more details:

    • Angular 2 Updating objects in “real time.”

提交回复
热议问题