为什么不调用()函数?
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。