diff --git a/src/carousel/carousel.js b/src/carousel/carousel.js
index 4e9edd21ee..ffdd2b64e3 100644
--- a/src/carousel/carousel.js
+++ b/src/carousel/carousel.js
@@ -5,7 +5,8 @@
* A pure AngularJS carousel.
*
* For no interval set the interval to non-number, or milliseconds of desired interval
-* Template: {{anything}}
+* To prevent pause upon mouseover set the nopause attribute to a truthy value
+* Template: {{anything}}
* To change the carousel's active slide set the active attribute to true
* Template: {{anything}}
*/
@@ -130,9 +131,11 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
}
};
$scope.pause = function() {
- isPlaying = false;
- if (currentTimeout) {
- $timeout.cancel(currentTimeout);
+ if (!$scope.noPause) {
+ isPlaying = false;
+ if (currentTimeout) {
+ $timeout.cancel(currentTimeout);
+ }
}
};
@@ -173,7 +176,8 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
templateUrl: 'template/carousel/carousel.html',
scope: {
interval: '=',
- noTransition: '='
+ noTransition: '=',
+ noPause: '='
}
};
}])
diff --git a/src/carousel/test/carousel.spec.js b/src/carousel/test/carousel.spec.js
index e7b44f87e1..c089c062f6 100644
--- a/src/carousel/test/carousel.spec.js
+++ b/src/carousel/test/carousel.spec.js
@@ -20,7 +20,7 @@ describe('carousel', function() {
{active:false,content:'three'}
];
elm = $compile(
- '' +
+ '' +
'' +
'{{slide.content}}' +
'' +
@@ -28,6 +28,7 @@ describe('carousel', function() {
)(scope);
carouselScope = elm.scope();
scope.interval = 5000;
+ scope.nopause = undefined;
scope.$apply();
});
afterEach(function() {
@@ -178,6 +179,17 @@ describe('carousel', function() {
$timeout.flush();
testSlideActive(2);
});
+
+ it('should not pause on mouseover if noPause', function() {
+ scope.$apply('nopause = true');
+ testSlideActive(0);
+ elm.trigger('mouseenter');
+ $timeout.flush();
+ testSlideActive(1);
+ elm.trigger('mouseleave');
+ $timeout.flush();
+ testSlideActive(2);
+ });
it('should remove slide from dom and change active slide', function() {
scope.$apply('slides[1].active = true');