@@ -297,38 +297,17 @@ function CarouselDemoCtrl($scope) {
297
297
</example>
298
298
*/
299
299
300
- . directive ( 'slide' , [ '$parse' , function ( $parse ) {
300
+ . directive ( 'slide' , function ( ) {
301
301
return {
302
302
require : '^carousel' ,
303
303
restrict : 'EA' ,
304
304
transclude : true ,
305
305
replace : true ,
306
306
templateUrl : 'template/carousel/slide.html' ,
307
307
scope : {
308
+ active : '=?'
308
309
} ,
309
310
link : function ( scope , element , attrs , carouselCtrl ) {
310
- //Set up optional 'active' = binding
311
- if ( attrs . active ) {
312
- var getActive = $parse ( attrs . active ) ;
313
- var setActive = getActive . assign ;
314
- var lastValue = scope . active = getActive ( scope . $parent ) ;
315
- scope . $watch ( function parentActiveWatch ( ) {
316
- var parentActive = getActive ( scope . $parent ) ;
317
-
318
- if ( parentActive !== scope . active ) {
319
- // we are out of sync and need to copy
320
- if ( parentActive !== lastValue ) {
321
- // parent changed and it has precedence
322
- lastValue = scope . active = parentActive ;
323
- } else {
324
- // if the parent can be assigned then do so
325
- setActive ( scope . $parent , parentActive = lastValue = scope . active ) ;
326
- }
327
- }
328
- return parentActive ;
329
- } ) ;
330
- }
331
-
332
311
carouselCtrl . addSlide ( scope , element ) ;
333
312
//when the scope is destroyed then remove the slide from the current slides array
334
313
scope . $on ( '$destroy' , function ( ) {
@@ -342,4 +321,4 @@ function CarouselDemoCtrl($scope) {
342
321
} ) ;
343
322
}
344
323
} ;
345
- } ] ) ;
324
+ } ) ;
0 commit comments