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

Commit

Permalink
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/carousel/carousel.js
Original file line number Diff line number Diff line change
@@ -189,9 +189,21 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
replace: true,
templateUrl: 'template/carousel/slide.html',
scope: {
active: '='
},
link: function (scope, element, attrs, carouselCtrl) {
//Set up optional 'active' = binding
scope.active = false; // default value
if (attrs.active) {
var getActive = $parse(attrs.active);
var setActive = getActive.assign;

This comment has been minimized.

Copy link
@pkozlowski-opensource

pkozlowski-opensource Jun 22, 2013

Member

@ajoslin just wondering... can this happen that someone provides and non-assignable expression here?

This comment has been minimized.

Copy link
@ajoslin

ajoslin Jun 22, 2013

Author Contributor

Ah yes, I should add a test and throw an error I guess.

scope.$parent.$watch(getActive, function updateActive(value) {
scope.active = !!value;
});
scope.$watch(getActive, function(value) {
setActive(scope.$parent, !!value);
});
}

carouselCtrl.addSlide(scope, element);
//when the scope is destroyed then remove the slide from the current slides array
scope.$on('$destroy', function() {

0 comments on commit 17d6c3b

Please sign in to comment.