@@ -83,6 +83,9 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
83
83
/** Whether the `value` has been set to its initial value. */
84
84
private _isInitialized : boolean = false ;
85
85
86
+ /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
87
+ private _labelPosition : 'before' | 'after' = 'after' ;
88
+
86
89
/** The method to be called in order to update ngModel */
87
90
_controlValueAccessorChangeFn : ( value : any ) => void = ( value ) => { } ;
88
91
@@ -127,15 +130,29 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
127
130
this . labelPosition = ( v == 'start' ) ? 'after' : 'before' ;
128
131
}
129
132
133
+
130
134
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
131
- @Input ( ) labelPosition : 'before' | 'after' = 'after' ;
135
+ @Input ( )
136
+ get labelPosition ( ) {
137
+ return this . _labelPosition ;
138
+ }
139
+
140
+ set labelPosition ( v ) {
141
+ this . _labelPosition = ( v == 'before' ) ? 'before' : 'after' ;
142
+ if ( this . _radios ) {
143
+ this . _radios . forEach ( radio => radio . groupValueChanged ( ) ) ;
144
+ }
145
+ }
132
146
133
147
/** Whether the radio button is disabled. */
134
148
@Input ( )
135
149
get disabled ( ) : boolean { return this . _disabled ; }
136
150
set disabled ( value ) {
137
151
// The presence of *any* disabled value makes the component disabled, *except* for false.
138
152
this . _disabled = ( value != null && value !== false ) ? true : null ;
153
+ if ( this . _radios ) {
154
+ this . _radios . forEach ( radio => radio . groupValueChanged ( ) ) ;
155
+ }
139
156
}
140
157
141
158
/** Value of the radio button. */
@@ -309,6 +326,7 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
309
326
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
310
327
private _elementRef : ElementRef ,
311
328
private _renderer : Renderer ,
329
+ private _changeDetector : ChangeDetectorRef ,
312
330
public radioDispatcher : UniqueSelectionDispatcher ) {
313
331
// Assertions. Ideally these should be stripped out by the compiler.
314
332
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -349,6 +367,7 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
349
367
// Notify all radio buttons with the same name to un-check.
350
368
this . _radioDispatcher . notify ( this . id , this . name ) ;
351
369
}
370
+ this . _changeDetector . markForCheck ( ) ;
352
371
}
353
372
}
354
373
@@ -473,6 +492,10 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
473
492
this . _focusOriginMonitor . focusVia ( this . _inputElement . nativeElement , this . _renderer , 'keyboard' ) ;
474
493
}
475
494
495
+ groupValueChanged ( ) {
496
+ this . _changeDetector . markForCheck ( ) ;
497
+ }
498
+
476
499
ngOnInit ( ) {
477
500
if ( this . radioGroup ) {
478
501
// If the radio is inside a radio group, determine if it should be checked
0 commit comments