From daceb9810c85af78a3b6b46a9d0281ee92f4e562 Mon Sep 17 00:00:00 2001 From: Edan Weis Date: Wed, 10 Feb 2016 10:52:55 +1100 Subject: [PATCH 1/2] feat(slides): Added move event onSlideMove --- ionic/components/slides/slides.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ionic/components/slides/slides.ts b/ionic/components/slides/slides.ts index 5f155ab6f7..c2b6c6090e 100644 --- a/ionic/components/slides/slides.ts +++ b/ionic/components/slides/slides.ts @@ -22,7 +22,7 @@ import {Scroll} from '../scroll/scroll'; * ```ts * @Page({ * template: ` - * + * * *

Thank you for choosing the Awesome App!

*

@@ -58,6 +58,7 @@ import {Scroll} from '../scroll/scroll'; * @property {Number} [zoomDuration] - how long it should take to zoom a slide * @property {Number} [zoomMax] - the max scale an slide can be zoomed * @property {Any} (change) - expression to evaluate when a slide has been changed + * @property {Any} (move) - expression to evaluate when a slide is moving * @demo /docs/v2/demos/slides/ * @see {@link /docs/v2/components#slides Slides Component Docs} * @@ -214,6 +215,11 @@ export class Slides extends Ion { */ @Output() change: EventEmitter = new EventEmitter(); + /** + * @private + */ + @Output() move: EventEmitter = new EventEmitter(); + /** * @private * @param {ElementRef} elementRef TODO @@ -282,6 +288,10 @@ export class Slides extends Ion { options.onLazyImageReady = (swiper, slide, img) => { return this.options.onLazyImageReady && this.options.onLazyImageReady(swiper, slide, img); }; + options.onSliderMove = (swiper, e) => { + this.move.emit(swiper, e); + return this.options.onSliderMove && this.options.onSliderMove(swiper, e); + }; setTimeout(() => { var swiper = new Swiper(this.getNativeElement().children[0], options); From 148b3685f3b45a94c2463bb2cc873596a31442b7 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Wed, 17 Feb 2016 15:34:28 -0500 Subject: [PATCH 2/2] test(slides): add test for slides and remove the second parameter on the move event references #5379 --- ionic/components/slides/slides.ts | 2 +- ionic/components/slides/test/intro/index.ts | 4 ++++ ionic/components/slides/test/intro/main.html | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ionic/components/slides/slides.ts b/ionic/components/slides/slides.ts index 6f8da7db09..87696e31d4 100644 --- a/ionic/components/slides/slides.ts +++ b/ionic/components/slides/slides.ts @@ -284,7 +284,7 @@ export class Slides extends Ion { return this.options.onLazyImageReady && this.options.onLazyImageReady(swiper, slide, img); }; options.onSliderMove = (swiper, e) => { - this.move.emit(swiper, e); + this.move.emit(swiper); return this.options.onSliderMove && this.options.onSliderMove(swiper, e); }; diff --git a/ionic/components/slides/test/intro/index.ts b/ionic/components/slides/test/intro/index.ts index 9f7ca60173..204701ab65 100644 --- a/ionic/components/slides/test/intro/index.ts +++ b/ionic/components/slides/test/intro/index.ts @@ -29,6 +29,10 @@ class IntroPage { slider.isEnd ? this.continueText = "Continue" : this.continueText = "Skip"; } + onSlideMove(slider) { + console.log("Slide move", slider); + } + skip() { this.nav.push(MainPage); } diff --git a/ionic/components/slides/test/intro/main.html b/ionic/components/slides/test/intro/main.html index e46a13e618..7c899cfe05 100644 --- a/ionic/components/slides/test/intro/main.html +++ b/ionic/components/slides/test/intro/main.html @@ -8,7 +8,7 @@ - +

Thank you for choosing the Awesome App!