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

Commit

Permalink
fix(carousel): decouple animation information from DOM
Browse files Browse the repository at this point in the history
- Change to use `$animate.enabled` to determine animation state

Closes #4737
Fixes #4516
  • Loading branch information
wesleycho committed Oct 26, 2015
1 parent 8899fc8 commit 38c1b14
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ angular.module('ui.bootstrap.carousel', [])
var self = this,
slides = self.slides = $scope.slides = [],
NEW_ANIMATE = angular.version.minor >= 4,
NO_TRANSITION = 'uib-noTransition',
SLIDE_DIRECTION = 'uib-slideDirection',
currentIndex = -1,
currentInterval, isPlaying;
Expand Down Expand Up @@ -200,7 +199,7 @@ angular.module('ui.bootstrap.carousel', [])
};

$scope.$watch('noTransition', function(noTransition) {
$element.data(NO_TRANSITION, noTransition);
$animate.enabled($element, noTransition);
});

}])
Expand Down Expand Up @@ -257,8 +256,7 @@ angular.module('ui.bootstrap.carousel', [])
.animation('.item', [
'$injector', '$animate',
function ($injector, $animate) {
var NO_TRANSITION = 'uib-noTransition',
SLIDE_DIRECTION = 'uib-slideDirection',
var SLIDE_DIRECTION = 'uib-slideDirection',
$animateCss = null;

if ($injector.has('$animateCss')) {
Expand All @@ -276,7 +274,7 @@ function ($injector, $animate) {
beforeAddClass: function(element, className, done) {
// Due to transclusion, noTransition property is on parent's scope
if (className == 'active' && element.parent() && element.parent().parent() &&
!element.parent().parent().data(NO_TRANSITION)) {
!$animate.enabled(element)) {
var stopped = false;
var direction = element.data(SLIDE_DIRECTION);
var directionClass = direction == 'next' ? 'left' : 'right';
Expand Down Expand Up @@ -306,7 +304,7 @@ 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().parent() &&
!element.parent().parent().data(NO_TRANSITION)) {
!$animate.enabled(element)) {
var stopped = false;
var direction = element.data(SLIDE_DIRECTION);
var directionClass = direction == 'next' ? 'left' : 'right';
Expand Down

0 comments on commit 38c1b14

Please sign in to comment.