angular 2 : Using slick caroussel inside a template

后端 未结 1 643
梦如初夏
梦如初夏 2021-01-28 14:00

I use slick carousel as a component in my angular project ; this slick component is like below :

@Component({
    selector: \'slick-slider\',

    template: `
           


        
相关标签:
1条回答
  • 2021-01-28 14:45

    If you're using the slick-slider component I detailed here I think you'll need to modify it a little. I was reading the specs of the slider here and you have methods to add/remove a slide. So maybe the workaround would be adding a new method to the slick-slider component to update the sliders. Something like this:

    update(elements: any[]) {
        jQuery(this.el.nativeElement).slickRemove() //for each slide you have
        jQuery(this.el.nativeElement).slickAdd('...') //for each new slide with the required template
    }
    

    Haven't tested this, but I think this could be the way to go.

    0 讨论(0)
提交回复
热议问题