光滑不工作Angular 2

时间:2017-02-01 09:40:45

标签: jquery angular carousel slick.js

我手动在index.html上添加了slick.js。当我手动放置图像时,Slick正在工作。但是当我把它放在阵列上并且使用* ng时,光滑没有响应。

    import { Component,OnInit } from 'angular2/core';
    declare var jQuery: any;


    @Component({
        selector: 'SlickCarousel',
        template:'

    <div class="carousel-block">
        <div class="slick">
            <div class="single-item" *ngIf="items">
            <!--template bindings={}-->
                <img *ngFor="#slickItem of items" src="theme/images/{{slickItem}}" alt="Pinoy BoybandPH">
            </div>   
        </div>

        <div class="upper-geometric">
            <img src="theme/images/geometric-upper-splash.png" alt="">
        </div>  


   ' })
    export class CarouselComponent implements OnInit{
        items = ['image1-splash.jpg','image2-splash.jpg','image3-splash.jpg'];
        slickItem = new Array();

    ngOnInit():any {
        jQuery('.single-item').slick({
            infinite: true,
            slidesToShow: 1,
            slidesToScroll: 1,
            arrows: true,
            autoplay:true,
            autoplaySpeed: 5000,
            cssEase: 'linear'
        });
    }

}

0 个答案:

没有答案