Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
swiper.component.ts
main.ts (If you are using Angular SSR)
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
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();
}
}
Beta Was this translation helpful? Give feedback.
All reactions