From 80f5edd09029f77e631f435f180f8c5adeb430b9 Mon Sep 17 00:00:00 2001 From: Steven Pribilinskiy Date: Wed, 2 Sep 2015 00:29:09 +0300 Subject: [PATCH] Fix `no-transition` attribute data storage lookup Following code ``` $scope.$watch('noTransition', function(noTransition) { $element.data(NO_TRANSITION, noTransition); }); ``` sets a data attribute value on the `carousel` element. The `element.parent()` that can be found in animation mistakenly targets the child `.carousel-inner` hence the attribute have no effect on the slider. This PR fixes this --- src/carousel/carousel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/carousel/carousel.js b/src/carousel/carousel.js index 4e48d95850..6dfc7cefef 100644 --- a/src/carousel/carousel.js +++ b/src/carousel/carousel.js @@ -356,8 +356,8 @@ function ($injector, $animate) { return { beforeAddClass: function (element, className, done) { // Due to transclusion, noTransition property is on parent's scope - if (className == 'active' && element.parent() && - !element.parent().data(NO_TRANSITION)) { + if (className == 'active' && element.parent() && element.parent().parent() && + !element.parent().parent().data(NO_TRANSITION)) { var stopped = false; var direction = element.data(SLIDE_DIRECTION); var directionClass = direction == 'next' ? 'left' : 'right'; @@ -386,8 +386,8 @@ function ($injector, $animate) { }, beforeRemoveClass: function (element, className, done) { // Due to transclusion, noTransition property is on parent's scope - if (className === 'active' && element.parent() && - !element.parent().data(NO_TRANSITION)) { + if (className === 'active' && element.parent() && element.parent().parent() && + !element.parent().parent().data(NO_TRANSITION)) { var stopped = false; var direction = element.data(SLIDE_DIRECTION); var directionClass = direction == 'next' ? 'left' : 'right';