Skip to content

Commit

Permalink
feat(angular): remove deprecated index property (#5412)
Browse files Browse the repository at this point in the history
  • Loading branch information
vltansky committed Feb 1, 2022
1 parent f94322c commit 63642a1
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/angular/src/swiper.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,6 @@ export class SwiperComponent implements OnInit {
}
private _virtual: VirtualOptions | boolean | '';

@Input()
set index(index: number) {
console.warn('`[(index)]` prop is deprecated and will be removed in upcoming versions');
this.setIndex(index);
}
@Input()
set config(val: SwiperOptions) {
this.updateSwiper(val);
Expand Down Expand Up @@ -507,8 +502,6 @@ export class SwiperComponent implements OnInit {

@Output('unlock') s_unlock = new EventEmitter<Parameters<SwiperEvents['unlock']>>();

@Output() indexChange = new EventEmitter<number>();

@ViewChild('prevElRef', { static: false })
set prevElRef(el: ElementRef) {
this._prevElRef = el;
Expand Down Expand Up @@ -691,9 +684,6 @@ export class SwiperComponent implements OnInit {
this.swiperRef.virtual.update(true);
}
this._changeDetectorRef.detectChanges();
swiperRef.on('slideChange', () => {
this.indexChange.emit(this.swiperRef.realIndex);
});
}
});
}
Expand Down Expand Up @@ -918,25 +908,6 @@ export class SwiperComponent implements OnInit {
(this.swiperRef.params[_key] as any) = value;
}
}
/**
* @deprecated will be removed in upcoming versions
*/
setIndex(index: number, speed?: number, silent?: boolean): void {
if (!this.isSwiperActive) {
this.initialSlide = index;
return;
}
if (index === this.swiperRef.activeIndex) {
return;
}
this._ngZone.runOutsideAngular(() => {
if (this.loop) {
this.swiperRef.slideToLoop(index, speed, !silent);
} else {
this.swiperRef.slideTo(index, speed, !silent);
}
});
}

ngOnDestroy() {
this._ngZone.runOutsideAngular(() => {
Expand Down

0 comments on commit 63642a1

Please sign in to comment.