Skip to content

Commit

Permalink
fix(slides): add id to the slide component to grab the correct pagina…
Browse files Browse the repository at this point in the history
…tion

fixes #5745 references #5508
  • Loading branch information
brandyscarney committed Apr 18, 2016
1 parent b3b553e commit 7263728
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ionic/components/slides/slides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ import {Scroll} from '../scroll/scroll';
'<div [class.hide]="!showPager" class="swiper-pagination"></div>' +
'</div>',
directives: [NgClass],
host: {
'[id]': 'slideId'
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
Expand All @@ -82,6 +85,16 @@ export class Slides extends Ion {
*/
public rapidUpdate: Function;

/**
* @private
*/
private id: number;

/**
* @private
*/
private slideId: string;

/**
* @private
*/
Expand Down Expand Up @@ -204,6 +217,9 @@ export class Slides extends Ion {
this.rapidUpdate = debounce(() => {
this.update();
}, 10);

this.id = ++slidesId;
this.slideId = 'slides-' + this.id;
}

/**
Expand All @@ -216,8 +232,10 @@ export class Slides extends Ion {

this.showPager = isTrueProperty(this.pager);

let paginationId = '#' + this.slideId + ' .swiper-pagination';

var options = defaults({
pagination: '.swiper-pagination',
pagination: paginationId,
}, this.options);

options.onTap = (swiper, e) => {
Expand Down Expand Up @@ -706,3 +724,5 @@ export class Slide {
}
})
export class SlideLazy {}

let slidesId = -1;

0 comments on commit 7263728

Please sign in to comment.