@@ -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. */
@@ -327,6 +344,7 @@ export class MdRadioButton implements OnInit {
327
344
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
328
345
private _elementRef : ElementRef ,
329
346
private _renderer : Renderer ,
347
+ private _changeDetector : ChangeDetectorRef ,
330
348
public radioDispatcher : UniqueSelectionDispatcher ) {
331
349
// Assertions. Ideally these should be stripped out by the compiler.
332
350
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -368,6 +386,7 @@ export class MdRadioButton implements OnInit {
368
386
// Notify all radio buttons with the same name to un-check.
369
387
this . radioDispatcher . notify ( this . id , this . name ) ;
370
388
}
389
+ this . _changeDetector . markForCheck ( ) ;
371
390
}
372
391
}
373
392
@@ -431,6 +450,10 @@ export class MdRadioButton implements OnInit {
431
450
this . _disabled = ( value != null && value !== false ) ? true : null ;
432
451
}
433
452
453
+ groupValueChanged ( ) {
454
+ this . _changeDetector . markForCheck ( ) ;
455
+ }
456
+
434
457
ngOnInit ( ) {
435
458
if ( this . radioGroup ) {
436
459
// If the radio is inside a radio group, determine if it should be checked
0 commit comments