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

Unable to disable infinite looping of slides #3

Closed aparnacyanam closed 7 years ago

aparnacyanam commented 7 years ago

I am using your package to include a carousel in my project.I have added customized previous and next buttons and want to disable the infinite looping.I have referred your documentation and found that infinite looping is enabled by default and can be disabled using infinite= "false", but even after including this code, it is not disabled. everything works perfectly except the infinite looping.Please let me know if I am missing anything.

mihnsen commented 7 years ago

@aparnacyanam Fixed on master 419ae95

aparnacyanam commented 7 years ago

@mihnsen Thank you for the quick fix.Did you republish the module with a version change?

mihnsen commented 7 years ago

@aparnacyanam Yes, I've just republished bower and node package

aparnacyanam commented 7 years ago

@mihnsen I have a specific requirement, when I am on the first slide, the previous button and when I am on the last slide, the next button should call user-defined functions.So I had to disable the infinite looping but with your change looks like the button is not clickable.My code is as follows where itemsLen is number of slides:

    <ui-carousel slides="item"
                        dots="true" class="ui-carousel"
                         infinite= "false"
                        on-init="onCarouselInit(ctrl.currentSlide)">
                <carousel-item>
                    <h2>{{item.title}}</h2>
                    <img ng-src="/public/images/{{ item.image }}" alt="{{ item.image }}" />
                </carousel-item>
                <carousel-prev>
                    <a ng-if="ctrl.currentSlide !== 0">Previous </a>
                    <div ng-if="ctrl.currentSlide === 0">
                        <a href="/gotohome">Home Page</a>
                    </div>
                </carousel-prev>
                <carousel-next>
                    <a ng-if="ctrl.currentSlide !== (itemsLen-1)">Next</a>
                    <button  type='button'ng-if="ctrl.currentSlide === (itemsLen-1)" ng-click="connect()">Connect</button>
                </carousel-next>
            </ui-carousel>

Appreciate your help.

mihnsen commented 7 years ago

Yes, your source looks good, Let me change a little bit with disable on js and enable clickable on button.

mihnsen commented 7 years ago

Fixed on master, Hope it works like you want :smile:

aparnacyanam commented 7 years ago

@mihnsen Thank you for this update.This helped me to solve the issue I was running into. It works perfectly. I am closing this issue as you have addressed it. Thank you once again and All the best .