why is autofill causing swiperjs slides to advance?

Discussão em 'Angular' iniciado por L.J.R., Fevereiro 13, 2025.

  1. L.J.R.

    L.J.R. Guest

    I am having an issue using swiper in Angular. When I use autofill for my reactive form, it slides forward 4 slides. Right now I'm initializing the swiper element in ngAfterViewInit() and I tried to move the initialization into ngOnInit or constructor but that didn't work.

    This is how I'm initializing the swiper element in my component's ts file:

    ngAfterViewInit(): void {
    this.swiper = this.swiperRef?.nativeElement.swiper;

    if (this.swiper) {
    this.swiper.allowTouchMove = false;
    }
    }


    I don't think the problem is with the specific variable assignment, but maybe it's helpful to see.

    The same thing is happening when I click a different window and click back onto the window where my application is rendered, except when I do that it only advances 1 slide forward.

    Does anybody have any ideas why this could be happening?

    Continue reading...

Compartilhe esta Página