From 3e5d360ebfc42560f7de355d4de90438be000c81 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Wed, 16 Dec 2015 14:36:13 -0500 Subject: [PATCH] fix(slides): change slideChanged to change and add warning closes #759 --- ionic/components/slides/slides.ts | 15 +++++++-------- ionic/components/slides/test/intro/index.ts | 2 +- ionic/components/slides/test/intro/main.html | 2 +- ionic/components/slides/test/loop/main.html | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ionic/components/slides/slides.ts b/ionic/components/slides/slides.ts index c69296464d..87a59bc6d5 100644 --- a/ionic/components/slides/slides.ts +++ b/ionic/components/slides/slides.ts @@ -1,4 +1,4 @@ -import {Directive, Component, ElementRef, Host, EventEmitter} from 'angular2/core'; +import {Directive, Component, ElementRef, Host, EventEmitter, Output} from 'angular2/core'; import {NgClass} from 'angular2/common'; import {Ion} from '../ion'; @@ -34,7 +34,7 @@ import {Scroll} from '../scroll/scroll'; * ```ts * @Page({ * template: ` - * + * * *

Thank you for choosing the Awesome App!

*

@@ -65,7 +65,7 @@ import {Scroll} from '../scroll/scroll'; * @property {Boolean} [bounce] - whether the slides should bounce * @property {Number} [index] - The slide index to start on * @property [pager] - add this property to enable the slide pager - * @property {Any} [slideChanged] - expression to evaluate when a slide has been changed + * @property {Any} [change] - expression to evaluate when a slide has been changed * @see {@link /docs/v2/components#slides Slides Component Docs} */ @Component({ @@ -81,9 +81,6 @@ import {Scroll} from '../scroll/scroll'; 'zoomDuration', 'zoomMax' ], - outputs: [ - 'slideChanged' - ], template: '

' + '
' + @@ -94,18 +91,20 @@ import {Scroll} from '../scroll/scroll'; directives: [NgClass] }) export class Slides extends Ion { + @Output() change:EventEmitter = new EventEmitter(); /** * @private * @param {ElementRef} elementRef TODO */ constructor(elementRef: ElementRef, config: Config) { + super(elementRef, config); this.rapidUpdate = util.debounce(() => { this.update(); }, 10); - this.slideChanged = new EventEmitter('slideChanged'); + console.warn("(slideChanged) deprecated. Use (change) to track slide changes."); } /** @@ -151,7 +150,7 @@ export class Slides extends Ion { return this.options.onSlideChangeStart && this.options.onSlideChangeStart(swiper); }; options.onSlideChangeEnd = (swiper) => { - this.slideChanged.next(swiper); + this.change.next(swiper); return this.options.onSlideChangeEnd && this.options.onSlideChangeEnd(swiper); }; options.onLazyImageLoad = (swiper, slide, img) => { diff --git a/ionic/components/slides/test/intro/index.ts b/ionic/components/slides/test/intro/index.ts index b0fecbd367..f3795a8ce5 100644 --- a/ionic/components/slides/test/intro/index.ts +++ b/ionic/components/slides/test/intro/index.ts @@ -6,6 +6,6 @@ import {App} from 'ionic/ionic'; }) class MyApp { onSlideChanged(slider) { - console.log('Slide chnaged', slider); + console.log('Slide changed', slider); } } diff --git a/ionic/components/slides/test/intro/main.html b/ionic/components/slides/test/intro/main.html index 53baf00e2c..dd0363c796 100644 --- a/ionic/components/slides/test/intro/main.html +++ b/ionic/components/slides/test/intro/main.html @@ -42,7 +42,7 @@ Grid Icons - +

Thank you for choosing the Awesome App!