@@ -88,6 +88,9 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
88
88
/** Whether the `value` has been set to its initial value. */
89
89
private _isInitialized : boolean = false ;
90
90
91
+ /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
92
+ private _labelPosition : 'before' | 'after' = 'after' ;
93
+
91
94
/** The method to be called in order to update ngModel */
92
95
_controlValueAccessorChangeFn : ( value : any ) => void = ( value ) => { } ;
93
96
@@ -131,8 +134,19 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
131
134
this . labelPosition = ( v == 'start' ) ? 'after' : 'before' ;
132
135
}
133
136
137
+
134
138
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
135
- @Input ( ) labelPosition : 'before' | 'after' = 'after' ;
139
+ @Input ( )
140
+ get labelPosition ( ) {
141
+ return this . _labelPosition ;
142
+ }
143
+
144
+ set labelPosition ( v ) {
145
+ this . _labelPosition = ( v == 'before' ) ? 'before' : 'after' ;
146
+ if ( this . _radios ) {
147
+ this . _radios . forEach ( radio => radio . groupValueChanged ( ) ) ;
148
+ }
149
+ }
136
150
137
151
/** Value of the radio button. */
138
152
@Input ( )
@@ -305,6 +319,7 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
305
319
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
306
320
private _elementRef : ElementRef ,
307
321
private _renderer : Renderer ,
322
+ private _changeDetector : ChangeDetectorRef ,
308
323
public radioDispatcher : UniqueSelectionDispatcher ) {
309
324
// Assertions. Ideally these should be stripped out by the compiler.
310
325
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -345,6 +360,7 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
345
360
// Notify all radio buttons with the same name to un-check.
346
361
this . _radioDispatcher . notify ( this . id , this . name ) ;
347
362
}
363
+ this . _changeDetector . markForCheck ( ) ;
348
364
}
349
365
}
350
366
@@ -464,6 +480,10 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
464
480
this . _focusOriginMonitor . focusVia ( this . _inputElement . nativeElement , this . _renderer , 'keyboard' ) ;
465
481
}
466
482
483
+ groupValueChanged ( ) {
484
+ this . _changeDetector . markForCheck ( ) ;
485
+ }
486
+
467
487
ngOnInit ( ) {
468
488
if ( this . radioGroup ) {
469
489
// If the radio is inside a radio group, determine if it should be checked
0 commit comments