Slick Carousel with Angular JS

后端 未结 2 1271
庸人自扰
庸人自扰 2020-12-09 11:09

I am using Slick carousel in one of my AngularJS application. For that I have created directive as follows:

  myApp.directive(\'slickSlider\',function(){
            


        
2条回答
  •  执笔经年
    2020-12-09 11:52

    I suspect that the slick plugin may need the DOM to be fully rendered to work properly.

    Try:

    myApp.directive('slickSlider',function($timeout){
     return {
       restrict: 'A',
       link: function(scope,element,attrs) {
         $timeout(function() {
             $(element).slick(scope.$eval(attrs.slickSlider));
         });
       }
     }
    }); 
    

提交回复
热议问题