Just as an FYI… in Beta 2, this works about half the time, and the other half I get “ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘activeIndex’ of undefined”. Obviously, I can’t rely on slides being ready to be used in the ionViewDidEnter event, so what would be the proper way to do it in Beta 2 and going forward?
import { Slides } from '@ionic/angular';
@Component({
...
})
export class TutorialPage {
@ViewChild('slides', { read: Slides }) slides: Slides;
ionViewDidEnter() {
console.log('ionViewDidEnter slideIndex: ' + this.slides.getActiveIndex());
}
}
I’ve seen several posts that you need to wait for the ionSlidesDidLoad event, but I can’t figure out a way to do it (or maybe an event to attach to it in) that actually fires the event consistently…
This never seems to fire the event
ngOnInit() {
this.slides.ionSlidesDidLoad.subscribe((value) => {
console.log('StartPage ngOnInit ionSlidesDidLoad');
});
}