From ea39454efd9d974b055271ceac79c63f6f0284da Mon Sep 17 00:00:00 2001 From: Alexander Timmermans Date: Wed, 13 Jul 2016 19:18:11 +0200 Subject: [PATCH 1/2] Support angular expression in name. --- angular-carousel.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/angular-carousel.js b/angular-carousel.js index 6dbc9b5..397969c 100644 --- a/angular-carousel.js +++ b/angular-carousel.js @@ -220,8 +220,13 @@ angular.module('angular-carousel', []) if(slides.length > 0) { // Create new carousel and duplicate slides - name = attrs.ngCarouselName; - currentCarousel = Carousel.add(slides.length, attrs.ngCarouselName, scope, { + if(attrs.ngCarouselName != undefined){ + name = attrs.ngCarouselName; + } + else if(attrs.ngCarouselExpression != undefined) { + name = scope.$eval(attrs.ngCarouselExpression); + } + currentCarousel = Carousel.add(slides.length, name, scope, { looping: looping }); angular.forEach(savedCallbacks, function(savedCallback) { From 05b064b91de61c57043adb4f1aae6172fd50ea55 Mon Sep 17 00:00:00 2001 From: Alexander Timmermans Date: Wed, 13 Jul 2016 19:19:41 +0200 Subject: [PATCH 2/2] Don't use global events (because turning off will also turn off events of other libraries). --- angular-carousel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-carousel.js b/angular-carousel.js index 397969c..2f2ebe4 100644 --- a/angular-carousel.js +++ b/angular-carousel.js @@ -402,8 +402,8 @@ angular.module('angular-carousel', []) scope.$on('$destroy', function() { $timeout.cancel(refreshInteractionWithDomTimer); element.off('mouseover mouseout'); - $document.off(pressEvent); - $document.off(releaseEvent); + $document.off(pressEvent, carouselPress); + $document.off(releaseEvent, carouselRelease); slideContainer.off('transitionend oTransitionEnd webkitTransitionEnd'); currentCarousel.onSlideChangeCallbacks = []; Carousel.remove(name);