I am getting this error in console, when I use Swiper in Angular 17 Server Side Rendering application.
ERROR TypeError: this.el.nativeElement.initialize is not a function.
This error occurs when I use directive for swiper
import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core';
import { SwiperContainer } from 'swiper/element';
import { SwiperOptions } from 'swiper/types';
@directive({
selector: '[appSwiper]',
standalone: true
})
export class SwiperDirective implements AfterViewInit {
@input() config?: SwiperOptions;
constructor(private el: ElementRef) { }
ngAfterViewInit(): void {
Object.assign(this.el.nativeElement, this.config);
this.el.nativeElement.initialize();
}
}