Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
rnCarouselControlsAllowLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
tossp committed Jun 15, 2015
1 parent 12f28ed commit 3d8c81d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/directives/rn-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,11 @@

if (iAttributes.rnCarouselControls!==undefined) {
// dont use a directive for this
var canloop = ((isRepeatBased ? scope[repeatCollection.replace('::', '')].length : currentSlides.length) > 1) ? angular.isDefined(tAttributes['rnCarouselControlsAllowLoop']) : false;
var nextSlideIndexCompareValue = isRepeatBased ? repeatCollection.replace('::', '') + '.length - 1' : currentSlides.length - 1;
var tpl = '<div class="rn-carousel-controls">\n' +
' <span class="rn-carousel-control rn-carousel-control-prev" ng-click="prevSlide()" ng-if="carouselIndex > 0"></span>\n' +
' <span class="rn-carousel-control rn-carousel-control-next" ng-click="nextSlide()" ng-if="carouselIndex < ' + nextSlideIndexCompareValue + '"></span>\n' +
' <span class="rn-carousel-control rn-carousel-control-prev" ng-click="prevSlide()" ng-if="carouselIndex > 0 || ' + canloop + '"></span>\n' +
' <span class="rn-carousel-control rn-carousel-control-next" ng-click="nextSlide()" ng-if="carouselIndex < ' + nextSlideIndexCompareValue + ' || ' + canloop + '"></span>\n' +
'</div>';
iElement.parent().append($compile(angular.element(tpl))(scope));
}
Expand Down

0 comments on commit 3d8c81d

Please sign in to comment.