Why do() function is not invoked ?
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++;
});
}
}
Here is a stackblitz for you.