How do I apply renderer2 at the angle?

Asked

Viewed 15 times

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;
  }

}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.