@@ -128,31 +128,14 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
128
128
}
129
129
130
130
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
131
- _labelPosition : 'before' | 'after' = 'after' ;
132
- @Input ( )
133
- get labelPosition ( ) : 'before' | 'after' {
134
- return this . _labelPosition ;
135
- }
136
- set labelPosition ( v : 'before' | 'after' ) {
137
- this . _labelPosition = v
138
- if ( this . _radios ) {
139
- this . _radios . forEach ( ( radio ) => {
140
- radio . labelPosition = this . _labelPosition ;
141
- } ) ;
142
- }
143
- }
131
+ @Input ( ) labelPosition : 'before' | 'after' = 'after' ;
144
132
145
133
/** Whether the radio button is disabled. */
146
134
@Input ( )
147
135
get disabled ( ) : boolean { return this . _disabled ; }
148
136
set disabled ( value ) {
149
137
// The presence of *any* disabled value makes the component disabled, *except* for false.
150
138
this . _disabled = ( value != null && value !== false ) ? true : null ;
151
- if ( this . _radios ) {
152
- this . _radios . forEach ( ( radio ) => {
153
- radio . disabled = this . _disabled ;
154
- } )
155
- }
156
139
}
157
140
158
141
/** Value of the radio button. */
@@ -183,6 +166,8 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
183
166
this . _checkSelectedRadioButton ( ) ;
184
167
}
185
168
169
+ constructor ( private _change : ChangeDetectorRef ) { }
170
+
186
171
/**
187
172
* Initialize properties once content children are available.
188
173
* This allows us to propagate relevant attributes to associated buttons.
@@ -244,6 +229,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
244
229
*/
245
230
writeValue ( value : any ) {
246
231
this . value = value ;
232
+ this . _change . markForCheck ( ) ;
247
233
}
248
234
249
235
/**
@@ -305,26 +291,10 @@ export class MdRadioButton implements OnInit {
305
291
name : string ;
306
292
307
293
/** Used to set the 'aria-label' attribute on the underlying input element. */
308
- _ariaLabel : string ;
309
- @Input ( 'aria-label' )
310
- get ariaLabel ( ) : string {
311
- return this . _ariaLabel ;
312
- }
313
- set ariaLabel ( value : string ) {
314
- this . _ariaLabel = value ;
315
- this . _change . markForCheck ( ) ;
316
- }
294
+ @Input ( 'aria-label' ) ariaLabel : string ;
317
295
318
296
/** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */
319
- _ariaLabelledby : string ;
320
- @Input ( 'aria-labelledby' )
321
- get ariaLabelledby ( ) : string {
322
- return this . _ariaLabelledby ;
323
- }
324
- set ariaLabelledby ( value : string ) {
325
- this . _ariaLabelledby = value ;
326
- this . _change . markForCheck ( ) ;
327
- }
297
+ @Input ( 'aria-labelledby' ) ariaLabelledby : string ;
328
298
329
299
/** Whether this radio is disabled. */
330
300
private _disabled : boolean ;
@@ -341,10 +311,7 @@ export class MdRadioButton implements OnInit {
341
311
/** Whether the ripple effect for this radio button is disabled. */
342
312
@Input ( )
343
313
get disableRipple ( ) : boolean { return this . _disableRipple ; }
344
- set disableRipple ( value ) {
345
- this . _disableRipple = coerceBooleanProperty ( value ) ;
346
- this . _change . markForCheck ( ) ;
347
- }
314
+ set disableRipple ( value ) { this . _disableRipple = coerceBooleanProperty ( value ) ; }
348
315
349
316
/**
350
317
* Event emitted when the checked state of this radio button changes.
@@ -360,7 +327,6 @@ export class MdRadioButton implements OnInit {
360
327
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
361
328
private _elementRef : ElementRef ,
362
329
private _renderer : Renderer ,
363
- private _change : ChangeDetectorRef ,
364
330
public radioDispatcher : UniqueSelectionDispatcher ) {
365
331
// Assertions. Ideally these should be stripped out by the compiler.
366
332
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -402,7 +368,6 @@ export class MdRadioButton implements OnInit {
402
368
// Notify all radio buttons with the same name to un-check.
403
369
this . radioDispatcher . notify ( this . id , this . name ) ;
404
370
}
405
- this . _change . markForCheck ( ) ;
406
371
}
407
372
}
408
373
@@ -424,7 +389,6 @@ export class MdRadioButton implements OnInit {
424
389
this . radioGroup . selected = this ;
425
390
}
426
391
}
427
- this . _change . markForCheck ( ) ;
428
392
}
429
393
}
430
394
@@ -441,7 +405,6 @@ export class MdRadioButton implements OnInit {
441
405
442
406
set align ( v ) {
443
407
this . labelPosition = ( v == 'start' ) ? 'after' : 'before' ;
444
- this . _change . markForCheck ( ) ;
445
408
}
446
409
447
410
private _labelPosition : 'before' | 'after' ;
@@ -454,7 +417,6 @@ export class MdRadioButton implements OnInit {
454
417
455
418
set labelPosition ( value ) {
456
419
this . _labelPosition = value ;
457
- this . _change . markForCheck ( ) ;
458
420
}
459
421
460
422
/** Whether the radio button is disabled. */
@@ -467,7 +429,6 @@ export class MdRadioButton implements OnInit {
467
429
set disabled ( value : boolean ) {
468
430
// The presence of *any* disabled value makes the component disabled, *except* for false.
469
431
this . _disabled = ( value != null && value !== false ) ? true : null ;
470
- this . _change . markForCheck ( ) ;
471
432
}
472
433
473
434
ngOnInit ( ) {
0 commit comments