当前位置: 动力学知识库 > 问答 > 编程问答 >

angularjs - Angular App alongside jQuery Slick issue

问题描述:

I have a simple slick carousel in an Angular App, using angular-slick. Whenever I load the App for the first time (with the view that contains the slick carousel), the carousel displays correctly. However after switching to another view and returning to the carousel slick view, I get the following error:

TypeError: u.slick is not a function

the Carousel looks like this:

<div class="col-sm-6 col-sm-offset-3 mainContent">

<div style="height: 50px; margin-bottom:70px;">

<slick class="slider multiple-items slick-slider" slides-to-scroll="1" slides-to-show="3" infinite="true" speed="3000" autoplay="true" init-onload="true">

<div ng-class="slick-slide" style="width: 187px;"><h3 class="text-center">1</h3></div>

<div ng-cclass="slick-slide" style="width: 187px;"><h3 class="text-center">2</h3></div>

<div ng-cclass="slick-slide" style="width: 187px;"><h3 class="text-center">3</h3></div>

<div ng-cclass="slick-slide" style="width: 187px;"><h3 class="text-center">4</h3></div>

<div ng-cclass="slick-slide" style="width: 187px;"><h3 class="text-center">5</h3></div>

<div ng-cclass="slick-slide" style="width: 187px;"><h3 class="text-center">6</h3></div>

</slick>

</div>

</div>

Is there a reason why the (I guess) jQuery plugin gets "lost" after changing views?

Thanks

网友答案:

For anyone facing the same problem, I ended up using a different angular-slick directive, the one created by DevMarc (https://github.com/devmark/angular-slick-carousel), which solved the problem "auto-magically".

分享给朋友:
您可能感兴趣的文章:
随机阅读: