I have a slider which is generated by for loop over some array. This array is empty at the beginning and in the onInit() function a call is made to the httpservice fetching the data.
<ion-slides #agendaSlider (didChange)="onSlideChanged()">
<ion-slide *ngFor="let day of agenda">
</ion-slide>
</ion-slides>
After the Observable returned data and the array is filled I want to change the slider to the middle slide. However, the slider stays at the beginning. I believe this is due to the fact that the dom has not updated and there is no middle (5th in my case) slide.
How can I solve this problem?
Is there some way to wait for the DOM to update?
this._agendaService.getAgenda(dateStart, dateEnd, force)
.subscribe(
data => {
this.agenda = data;
console.log("Going to another slide");
this.slider.slideTo(5, 0, false);
}
)