This issue has only come up when I try to use the autoplay feature.
I have tried to include the option in the html:
<ion-slides #homeSlides
*ngIf="slides"
autoplay="5000"
autoplayDisableOnInteraction="false"
initialSlide=0
pager="true"
loop="true"
effect="fade"
autoHeight="true" >
<ion-slide *ngFor="let slide of slides" >
<ion-card (click) = "openPage(slide.component)">
<img id= "slide-img" [src]= "slide.img">
<div class="card-title" text-wrap> {{slide.title}} </div>
<div class="card-subtitle" text-wrap> {{slide.subtitle}} </div>
</ion-card>
</ion-slide>
</ion-slides>
Also have tried enabling it in my component:
@ViewChild('homeSlides') slider: Slides;
ionViewDidLoad() {
this.slider.update();
this.slider.autoplay = 5000;
this.slider.startAutoplay();
}
With the second method the stacktrace is:
ERROR TypeError: s._activeIndex is undefined
Stack trace:
autoplay@http://localhost:8100/build/main.js:42425:26
startAutoplay@http://localhost:8100/build/main.js:42469:5
Slides.prototype.startAutoplay@http://localhost:8100/build/main.js:55099:9
HomePage.prototype.ionViewDidLoad@http://localhost:8100/build/main.js:45351:9
ViewController.prototype._lifecycle@http://localhost:8100/build/main.js:17317:13
ViewController.prototype._didLoad@http://localhost:8100/build/main.js:17190:9
NavControllerBase.prototype._didLoad@http://localhost:8100/build/main.js:44560:13
....
I have looked through the Slides and Swiper implementations on GitHub but I cannot find where _activeIndex (or activeIndex) gets a value other than null
.
I know this is occurring on the autoplay() function at line 204 in the swiper.ts file.
Hopefully the source will help someone spot my mistake.
Not sure if this has anything to do with it, but when I try to use the [options] property and load in properties from an array I always get the error:
Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'options' since it isn't a known property of 'ion-slides'.
Anyone know how to solve this problem? Thanks!