Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(angular): remove deprecated index property #5412

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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