@@ -82,6 +82,9 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
82
82
/** Whether the `value` has been set to its initial value. */
83
83
private _isInitialized : boolean = false ;
84
84
85
+ /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
86
+ private _labelPosition : 'before' | 'after' = 'after' ;
87
+
85
88
/** The method to be called in order to update ngModel */
86
89
_controlValueAccessorChangeFn : ( value : any ) => void = ( value ) => { } ;
87
90
@@ -126,15 +129,29 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
126
129
this . labelPosition = ( v == 'start' ) ? 'after' : 'before' ;
127
130
}
128
131
132
+
129
133
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
130
- @Input ( ) labelPosition : 'before' | 'after' = 'after' ;
134
+ @Input ( )
135
+ get labelPosition ( ) {
136
+ return this . _labelPosition ;
137
+ }
138
+
139
+ set labelPosition ( v ) {
140
+ this . _labelPosition = ( v == 'before' ) ? 'before' : 'after' ;
141
+ if ( this . _radios ) {
142
+ this . _radios . forEach ( radio => radio . groupValueChanged ( ) ) ;
143
+ }
144
+ }
131
145
132
146
/** Whether the radio button is disabled. */
133
147
@Input ( )
134
148
get disabled ( ) : boolean { return this . _disabled ; }
135
149
set disabled ( value ) {
136
150
// The presence of *any* disabled value makes the component disabled, *except* for false.
137
151
this . _disabled = ( value != null && value !== false ) ? true : null ;
152
+ if ( this . _radios ) {
153
+ this . _radios . forEach ( radio => radio . groupValueChanged ( ) ) ;
154
+ }
138
155
}
139
156
140
157
/** Value of the radio button. */
@@ -323,6 +340,7 @@ export class MdRadioButton implements OnInit {
323
340
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
324
341
private _elementRef : ElementRef ,
325
342
private _renderer : Renderer ,
343
+ private _changeDetector : ChangeDetectorRef ,
326
344
public radioDispatcher : UniqueSelectionDispatcher ) {
327
345
// Assertions. Ideally these should be stripped out by the compiler.
328
346
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -364,6 +382,7 @@ export class MdRadioButton implements OnInit {
364
382
// Notify all radio buttons with the same name to un-check.
365
383
this . radioDispatcher . notify ( this . id , this . name ) ;
366
384
}
385
+ this . _changeDetector . markForCheck ( ) ;
367
386
}
368
387
}
369
388
@@ -427,6 +446,10 @@ export class MdRadioButton implements OnInit {
427
446
this . _disabled = ( value != null && value !== false ) ? true : null ;
428
447
}
429
448
449
+ groupValueChanged ( ) {
450
+ this . _changeDetector . markForCheck ( ) ;
451
+ }
452
+
430
453
ngOnInit ( ) {
431
454
if ( this . radioGroup ) {
432
455
// If the radio is inside a radio group, determine if it should be checked
0 commit comments