Ionic2 slider.length() gives wrong number

Hey there,

I would like to use slider.length() to get the total number of slides. Im creating slides with:

<ion-slides #bilderslider [options]="mySlideOptions" (ionDidChange)="onSlideChanged()">
<ion-slide *ngIf="bild1">
<img src="file=inseratedata/{{id}}/{{bild1}}">
</ion-slide>
<ion-slide *ngIf="bild2">
<img src="file=inseratedata/{{id}}/{{bild2}}">
</ion-slide>
<ion-slide *ngIf="bild3">
<img src="file=inseratedata/{{id}}/{{bild3}}">
</ion-slide>
<ion-slide *ngFor="let bild of restbilder">
<img src="file=inseratedata/{{id}}/{{bild.bildpfad}}">
</ion-slide>
</ion-slides>

Where bild1-bild3 are variables and restbilder is a array with some more pictures. In my Example I got those 3 variables set and the array has 2 elements, so in total 5 slides are created. The Pager Dots function only create 5 dots, so this is correct but the function slider.length returns 7 as result.

Is this a general bug or am I doing something wrong?

1 Like

Hi,

Did you get an aswer?

I am having the same issue…

Thanks!

3 Likes

hi @chack did you find the solution for your question if yes please share