1
From what I understand can not use the server-side to directly manipulate and Rendering native elements such as renderer2?
import { Component, Input, ElementRef, HostBinding, OnInit, Renderer2 } from '@angular/core';
import $ from 'jquery';
import 'owl.carousel';
@Component({
selector: 'app-owl-carousel',
template: `<ng-content></ng-content>`
})
export class OwlCarouselComponent implements OnInit {
@HostBinding('class') defaultClass = 'owl-carousel';
@Input() options: object;
$owlElement: any;
defaultOptions: any = {};
constructor(private el: ElementRef, private renderer: Renderer2 ) { }
ngOnInit(){}
ngAfterViewInit() {
this.$owlElement = $(this.el.nativeElement).owlCarousel(this.defaultOptions);
}
ngOnDestroy() {
this.$owlElement.owlCarousel('destroy');
this.$owlElement = null;
}
}