@@ -54,46 +54,33 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse'])
54
54
} )
55
55
56
56
// The accordion-group directive indicates a block of html that will expand and collapse in an accordion
57
- . directive ( 'accordionGroup' , [ '$parse' , function ( $parse ) {
57
+ . directive ( 'accordionGroup' , function ( ) {
58
58
return {
59
59
require :'^accordion' , // We need this directive to be inside an accordion
60
60
restrict :'EA' ,
61
61
transclude :true , // It transcludes the contents of the directive into the template
62
62
replace : true , // The element containing the directive will be replaced with the template
63
63
templateUrl :'template/accordion/accordion-group.html' ,
64
- scope :{ heading :'@' } , // Create an isolated scope and interpolate the heading attribute onto this scope
64
+ scope : {
65
+ heading : '@' , // Interpolate the heading attribute onto this scope
66
+ isOpen : '=?'
67
+ } ,
65
68
controller : function ( ) {
66
69
this . setHeading = function ( element ) {
67
70
this . heading = element ;
68
71
} ;
69
72
} ,
70
73
link : function ( scope , element , attrs , accordionCtrl ) {
71
- var getIsOpen , setIsOpen ;
72
-
73
74
accordionCtrl . addGroup ( scope ) ;
74
75
75
- scope . isOpen = false ;
76
-
77
- if ( attrs . isOpen ) {
78
- getIsOpen = $parse ( attrs . isOpen ) ;
79
- setIsOpen = getIsOpen . assign ;
80
-
81
- scope . $parent . $watch ( getIsOpen , function ( value ) {
82
- scope . isOpen = ! ! value ;
83
- } ) ;
84
- }
85
-
86
76
scope . $watch ( 'isOpen' , function ( value ) {
87
77
if ( value ) {
88
78
accordionCtrl . closeOthers ( scope ) ;
89
79
}
90
- if ( setIsOpen ) {
91
- setIsOpen ( scope . $parent , value ) ;
92
- }
93
80
} ) ;
94
81
}
95
82
} ;
96
- } ] )
83
+ } )
97
84
98
85
// Use accordion-heading below an accordion-group to provide a heading containing HTML
99
86
// <accordion-group>
0 commit comments