RxJS Obsevrable do()未被调用

时间:2018-03-08 21:30:54

标签: angular rxjs rxjs5

为什么不调用()函数?

export class AppComponent implements OnInit {
  name = 'Angular 5';
  events = [];
  existingEvents = [1,2,3,4,6]

  ngOnInit() {
    let i = 0;
    this.events.push('Initial');
    Observable.of(1,2,3,4,5)
    .do(() => { 
      // this block is not executing - why ?
      console.log(this.existingEvents[i]); 
      this.events.push(this.existingEvents[i]);
      i++;
    });
  }
}

以下是stackblitz

0 个答案:

没有答案