From 0c78026b6c11fd8d5abb947a13d47fa3696651cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20D?= Date: Mon, 27 Jul 2015 10:30:09 +0200 Subject: [PATCH] fix(carousel): clear `currentSlide` when there are no slides - Clear `currentSlide` when slides have been emptied Closes #4021 --- src/carousel/carousel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/carousel/carousel.js b/src/carousel/carousel.js index 3ebdd12264..0f096d5110 100644 --- a/src/carousel/carousel.js +++ b/src/carousel/carousel.js @@ -178,6 +178,11 @@ angular.module('ui.bootstrap.carousel', []) } else if (currentIndex > index) { currentIndex--; } + + //clean the currentSlide when no more slide + if (slides.length === 0) { + self.currentSlide = null; + } }; $scope.$watch('noTransition', function(noTransition) {