Dynamic Data binding


#1

I am trying to dynamically from my TS code update the “initialSlide” value (the initial slide of the slider), but it doesn’t dynamically update. It works fine upon load with some initially set “initialSlide” value. Any advice will be highly appreciated!

    <ion-slides class="slides" pager="true" [initialSlide]="initialSlide">
      <ion-slide class="slider" *ngFor="let i of photosArray">
        <img (click)="removePhoto(i.id)" class="sliderPhoto" [src]="i.imageURI">
      </ion-slide>
  </ion-slides>

#2

in my case it was due to the async pipe…
hope it works for you

add
this.slides.update()
in ionViewDidLoad() function.

and also define initialSlide in ionViewDidLoad() like
this.initialSlide = 1; //any other dynamic value of you choice.


#3

Yes, that was exactly it! I’m using move to next slide functionality with timeout instead. Thanks!