diff --git a/angular/src/directives/proxies.ts b/angular/src/directives/proxies.ts index 90ba301cf8..45ccbabe63 100644 --- a/angular/src/directives/proxies.ts +++ b/angular/src/directives/proxies.ts @@ -807,7 +807,7 @@ export class IonSlides { proxyOutputs(this, this.el, ['ionSlidesDidLoad', 'ionSlideTap', 'ionSlideDoubleTap', 'ionSlideWillChange', 'ionSlideDidChange', 'ionSlideNextStart', 'ionSlidePrevStart', 'ionSlideNextEnd', 'ionSlidePrevEnd', 'ionSlideTransitionStart', 'ionSlideTransitionEnd', 'ionSlideDrag', 'ionSlideReachStart', 'ionSlideReachEnd', 'ionSlideTouchStart', 'ionSlideTouchEnd']); } } -proxyMethods(IonSlides, ['update', 'updateAutoHeight', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes']); +proxyMethods(IonSlides, ['update', 'updateAutoHeight', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes', 'getSwiper']); proxyInputs(IonSlides, ['mode', 'options', 'pager', 'scrollbar']); export declare interface IonSpinner extends Components.IonSpinner {} diff --git a/core/api.txt b/core/api.txt index cbf68e8a09..f8e0f3756f 100644 --- a/core/api.txt +++ b/core/api.txt @@ -1068,6 +1068,7 @@ ion-slides,prop,pager,boolean,false,false,false ion-slides,prop,scrollbar,boolean,false,false,false ion-slides,method,getActiveIndex,getActiveIndex() => Promise ion-slides,method,getPreviousIndex,getPreviousIndex() => Promise +ion-slides,method,getSwiper,getSwiper() => Promise ion-slides,method,isBeginning,isBeginning() => Promise ion-slides,method,isEnd,isEnd() => Promise ion-slides,method,length,length() => Promise diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 4b6581458a..48fcd2dc1e 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -2388,6 +2388,10 @@ export namespace Components { */ 'getPreviousIndex': () => Promise; /** + * Get the Swiper instance. Use this to access the full Swiper API. See https://idangero.us/swiper/api/ for all API options. + */ + 'getSwiper': () => Promise; + /** * Get whether or not the current slide is the first slide. */ 'isBeginning': () => Promise; diff --git a/core/src/components/slides/readme.md b/core/src/components/slides/readme.md index d5467fc52c..81a3d7e7c8 100644 --- a/core/src/components/slides/readme.md +++ b/core/src/components/slides/readme.md @@ -614,6 +614,18 @@ Type: `Promise` +### `getSwiper() => Promise` + +Get the Swiper instance. +Use this to access the full Swiper API. +See https://idangero.us/swiper/api/ for all API options. + +#### Returns + +Type: `Promise` + + + ### `isBeginning() => Promise` Get whether or not the current slide is the first slide. diff --git a/core/src/components/slides/slides.tsx b/core/src/components/slides/slides.tsx index f81b013d06..d61073e4bf 100644 --- a/core/src/components/slides/slides.tsx +++ b/core/src/components/slides/slides.tsx @@ -320,6 +320,16 @@ export class Slides implements ComponentInterface { swiper.allowTouchMove = !lock; } + /** + * Get the Swiper instance. + * Use this to access the full Swiper API. + * See https://idangero.us/swiper/api/ for all API options. + */ + @Method() + async getSwiper(): Promise { + return this.swiper; + } + private async initSwiper() { const finalOptions = this.normalizeOptions(); @@ -332,10 +342,6 @@ export class Slides implements ComponentInterface { this.readySwiper(swiper); } - private getSwiper() { - return this.swiper; - } - private normalizeOptions(): SwiperOptions { // Base options, can be changed // TODO Add interface SwiperOptions