How to apply jquery after AngularJS partial template is loaded

后端 未结 7 2379
青春惊慌失措
青春惊慌失措 2020-12-13 10:28

I have a simple website that implements jQuery in order to create a Slider with some images in the Index.html top banner.

Now, I want to use AngularJS

7条回答
  •  情书的邮戳
    2020-12-13 11:01

    I had the same issue, I was running Jquery slick slider in simple html page it was working fine. How it works basically by including the slick.min.js file underneath the jquery.min.js file and then in script tags you need to initialize the plugin with options like e.g.

    $('.items').slick({
       infinite: true,
       slidesToShow: 3,
       slidesToScroll: 3
    });
    

    now coming back to the issue, when I added Angular JS to my page and made partials of the page and then went back to the browser to check weather the page was working fine or not, the page was working fine except the slider. Then I tried to move those slick.min.js and plugin initialization to the partials, and it worked :)

    How it worked I don't know the reason, since I am new to Angular but it worked and I am still wondering the reason.

提交回复
热议问题