mihnsen / ui-carousel

A simple, lightweight module for carousel in your AngularJS app, Inspired from slick carousel.
http://mihnsen.github.io/ui-carousel/
MIT License
77 stars 67 forks source link

How to change the value of slides-to-show based on screen size? #53

Open nitishkumarnitc opened 6 years ago

wolanskiadrian commented 6 years ago

I handle it by adding this to lib

$scope.$watch('ctrl.show', function (nVal, oVal) {
        if(nVal !== oVal) {
            _this.options.slidesToShow = nVal;

            if (_this.options.slidesToScroll > nVal) {
                _this.options.slidesToScroll = nVal;
            }

            _this.refreshCarousel();
        }
    });

Next in your controller you can simply setup value of slides-to-show depends of screen size.