@piotrde wrote:
Hey,
I have an
ion-slideswithngForinside. More or less:<ion slides> <ion-slide *ngFor="let item of items"> <div item-card [item]="item"></div> </ion-slide> <ion-slides>
items(the list of slides) is loaded asynchronously from server in thengAfterViewInit:ngAfterViewInit() { this.fetchItemsFromServer().subscribe( (items) => { this.items = items } ) }Everything works perfectly except one scenario:
Sometimes, I want to start from (show) a specific slide number on the page init.
I know there are
slideToandinitialSlidemethods but they don't work for me - I think it's because items are not yet fetched or not yet loaded into slider when I call these methods. Calling them at the end offetchItemsFromServer().subscribecallback seems to be to early.Is there any way to set slider position when elements are loaded asynchronously as above?
I was also thinking about using some kind of "redraw" callback for slider but can't find any. I am pretty sure that if I call
slideToafter items are loaded from server and*ngForand slider finished redraw, it's going to work. But I don't know how to install such a callback.All ideas welcome! Thanks in advance.
Posts: 1
Participants: 1