Skip to content

Commit 7263728

Browse files
committed
fix(slides): add id to the slide component to grab the correct pagination
fixes #5745 references #5508
1 parent b3b553e commit 7263728

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

ionic/components/slides/slides.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ import {Scroll} from '../scroll/scroll';
7272
'<div [class.hide]="!showPager" class="swiper-pagination"></div>' +
7373
'</div>',
7474
directives: [NgClass],
75+
host: {
76+
'[id]': 'slideId'
77+
},
7578
changeDetection: ChangeDetectionStrategy.OnPush,
7679
encapsulation: ViewEncapsulation.None,
7780
})
@@ -82,6 +85,16 @@ export class Slides extends Ion {
8285
*/
8386
public rapidUpdate: Function;
8487

88+
/**
89+
* @private
90+
*/
91+
private id: number;
92+
93+
/**
94+
* @private
95+
*/
96+
private slideId: string;
97+
8598
/**
8699
* @private
87100
*/
@@ -204,6 +217,9 @@ export class Slides extends Ion {
204217
this.rapidUpdate = debounce(() => {
205218
this.update();
206219
}, 10);
220+
221+
this.id = ++slidesId;
222+
this.slideId = 'slides-' + this.id;
207223
}
208224

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

217233
this.showPager = isTrueProperty(this.pager);
218234

235+
let paginationId = '#' + this.slideId + ' .swiper-pagination';
236+
219237
var options = defaults({
220-
pagination: '.swiper-pagination',
238+
pagination: paginationId,
221239
}, this.options);
222240

223241
options.onTap = (swiper, e) => {
@@ -706,3 +724,5 @@ export class Slide {
706724
}
707725
})
708726
export class SlideLazy {}
727+
728+
let slidesId = -1;

0 commit comments

Comments
 (0)