Closed rubenmiq closed 2 years ago
having this same issue. had to use the suggested answer in the linked stack overflow issue above as my solution for now:
<ion-slides #subscriptionSlider [options]="slideOpts" pager="true" (ionSlideTouchEnd)="ionSlideTouchEnd($event)">
...
</ion-slides>
// And then in ts file
ionSlideTouchEnd(event) {
this.subscriptionSlider.getActiveIndex().then(index => {
let realIndex = index;
if (event.target.swiper.isEnd) { // Added this code because getActiveIndex returns wrong index for last slide
realIndex = this.subscriptions.length - 1; // length of the ngFor you are using for the slides
}
// You can now use real index
});
}
Thanks for the issue! With the release of Ionic 6, we made the decision to deprecate ion-slides
in favor of using Swiper.js directly.
Moving forward, ion-slides
will only receive critical security fixes, and the component will be removed in Ionic 7. As a result, I am going to close this issue.
We have prepared migration guides for each of the 3 JavaScript frameworks we support, so developers can get started migrating right away.
Migration for Angular Migration for React Migration for Vue
We believe this change will lead to a healthier Ionic ecosystem as it frees up resources for the Ionic team to dedicate to other areas of this project while still giving developers options for carousels in their apps. Since ion-slides
currently uses Swiper under the hood, the behavior of your carousels should remain the same even after you migrate.
For more information on the reasoning for and benefits of this change, please see the ion-slides documentation.
Thank you!
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Bug Report
Ionic version: [x] 5.x
Current behavior: When the last slide is selected, the change event does not trigger
Expected behavior: ionDidChangeEvent should trigger on the last slide
Steps to reproduce: Make sure the browser window is on mobile size. Keep sliding the slides until the last slide is show. Check that the label with the index that changes on every slide does not change on the last slide,
Related code:
https://github.com/rubenptm/test-slider --> home.page.html
home.page.ts
home.page.scss
Other information: https://stackoverflow.com/questions/62049214/ionic-5-slides-ionslidedidchange-not-called-for-last-slide
Ionic info: