File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ angular.module('$strap.directives')
111111
112112} ] )
113113
114- . directive ( 'bsButtonsRadio' , [ '$parse ' , function ( $parse ) {
114+ . directive ( 'bsButtonsRadio' , [ '$timeout ' , function ( $timeout ) {
115115 'use strict' ;
116116 return {
117117 restrict : 'A' ,
@@ -132,10 +132,12 @@ angular.module('$strap.directives')
132132 // If we have a controller (i.e. ngModelController) then wire it up
133133 if ( controller ) {
134134
135- iElement
136- . find ( '[value]' ) . button ( )
137- . filter ( '[value="' + scope . $eval ( iAttrs . ngModel ) + '"]' )
138- . addClass ( 'active' ) ;
135+ $timeout ( function ( ) {
136+ iElement
137+ . find ( '[value]' ) . button ( )
138+ . filter ( '[value="' + controller . $viewValue + '"]' )
139+ . addClass ( 'active' ) ;
140+ } ) ;
139141
140142 iElement . on ( 'click.button.data-api' , function ( ev ) {
141143 scope . $apply ( function ( ) {
@@ -148,7 +150,8 @@ angular.module('$strap.directives')
148150 if ( newValue !== oldValue ) {
149151 var $btn = iElement . find ( '[value="' + scope . $eval ( iAttrs . ngModel ) + '"]' ) ;
150152 if ( $btn . length ) {
151- $ . fn . button . Constructor . prototype . toggle . call ( $btn . data ( 'button' ) ) ;
153+ $btn . button ( 'toggle' ) ;
154+ // $.fn.button.Constructor.prototype.toggle.call($btn.data('button'));
152155 }
153156 }
154157 } ) ;
Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ describe('button', function () {
7878 var $element = $ ( template . element ) . appendTo ( $sandbox ) ;
7979 $element = $compile ( $element ) ( scope ) ;
8080 scope . $digest ( ) ;
81+ if ( template === 'radio' || template === 'radio-single-model' ) {
82+ $timeout . flush ( ) ;
83+ }
8184 return $element ;
8285 }
8386
You can’t perform that action at this time.
0 commit comments