as i am new to angular2 i am expecting to find out a solution for the 
following scenario. The jQuery plugin is not working after getting the data 
-http://www.owlcarousel.owlgraphic.com/

i got issues on *var owl = 
jQuery(this.elementRef.nativeElement).find('#breif'); owl.owlCarousel();

My full code are given bellow


*angular 2 component:*

/ beautify ignore:start /import {Component, OnInit , ElementRef, Inject    } 
from '@angular/core';import {FORM_DIRECTIVES} from '@angular/common';import 
{CAROUSEL_DIRECTIVES} from 'ng2-bootstrap/components/carousel';/ beautify 
ignore:end /import {Api} from '../../../../services/api';

declare var jQuery:any;
@Component({
    selector: 'breif',
    directives: [CAROUSEL_DIRECTIVES],
    template: require('./template.html')})export class BreifComponent 
implements OnInit    {

  elementRef: ElementRef;
  breifs: Object;
public myInterval:number = 5000;public noWrapSlides:boolean = false;public 
slides:Array<any> = [];

    constructor(@Inject(ElementRef) elementRef: ElementRef ,  private api: Api) 
{
          this.elementRef = elementRef
          this.loadBreif();

      }

      ngOnInit() {

        **var owl = jQuery(this.elementRef.nativeElement).find('#breif');
        owl.owlCarousel();**

      }



    loadBreif(){
      this.api.getBreif().subscribe(
        data => {
          this.breifs = data.result.articles;

        },
        err => console.error(err),
        () => {

        }

      )

      }
}

template.html

<div class="owl-carousel" id="breif" ><div class="item" *ngFor="let breif of 
breifs"><h4>{{breif.title}}</h4></div>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to