@@ -127,31 +127,14 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
127
127
}
128
128
129
129
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
130
- _labelPosition : 'before' | 'after' = 'after' ;
131
- @Input ( )
132
- get labelPosition ( ) : 'before' | 'after' {
133
- return this . _labelPosition ;
134
- }
135
- set labelPosition ( v : 'before' | 'after' ) {
136
- this . _labelPosition = v
137
- if ( this . _radios ) {
138
- this . _radios . forEach ( ( radio ) => {
139
- radio . labelPosition = this . _labelPosition ;
140
- } ) ;
141
- }
142
- }
130
+ @Input ( ) labelPosition : 'before' | 'after' = 'after' ;
143
131
144
132
/** Whether the radio button is disabled. */
145
133
@Input ( )
146
134
get disabled ( ) : boolean { return this . _disabled ; }
147
135
set disabled ( value ) {
148
136
// The presence of *any* disabled value makes the component disabled, *except* for false.
149
137
this . _disabled = ( value != null && value !== false ) ? true : null ;
150
- if ( this . _radios ) {
151
- this . _radios . forEach ( ( radio ) => {
152
- radio . disabled = this . _disabled ;
153
- } )
154
- }
155
138
}
156
139
157
140
/** Value of the radio button. */
@@ -182,6 +165,8 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
182
165
this . _checkSelectedRadioButton ( ) ;
183
166
}
184
167
168
+ constructor ( private _change : ChangeDetectorRef ) { }
169
+
185
170
/**
186
171
* Initialize properties once content children are available.
187
172
* This allows us to propagate relevant attributes to associated buttons.
@@ -243,6 +228,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
243
228
*/
244
229
writeValue ( value : any ) {
245
230
this . value = value ;
231
+ this . _change . markForCheck ( ) ;
246
232
}
247
233
248
234
/**
@@ -301,26 +287,10 @@ export class MdRadioButton implements OnInit {
301
287
name : string ;
302
288
303
289
/** Used to set the 'aria-label' attribute on the underlying input element. */
304
- _ariaLabel : string ;
305
- @Input ( 'aria-label' )
306
- get ariaLabel ( ) : string {
307
- return this . _ariaLabel ;
308
- }
309
- set ariaLabel ( value : string ) {
310
- this . _ariaLabel = value ;
311
- this . _change . markForCheck ( ) ;
312
- }
290
+ @Input ( 'aria-label' ) ariaLabel : string ;
313
291
314
292
/** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */
315
- _ariaLabelledby : string ;
316
- @Input ( 'aria-labelledby' )
317
- get ariaLabelledby ( ) : string {
318
- return this . _ariaLabelledby ;
319
- }
320
- set ariaLabelledby ( value : string ) {
321
- this . _ariaLabelledby = value ;
322
- this . _change . markForCheck ( ) ;
323
- }
293
+ @Input ( 'aria-labelledby' ) ariaLabelledby : string ;
324
294
325
295
/** Whether this radio is disabled. */
326
296
private _disabled : boolean ;
@@ -337,10 +307,7 @@ export class MdRadioButton implements OnInit {
337
307
/** Whether the ripple effect for this radio button is disabled. */
338
308
@Input ( )
339
309
get disableRipple ( ) : boolean { return this . _disableRipple ; }
340
- set disableRipple ( value ) {
341
- this . _disableRipple = coerceBooleanProperty ( value ) ;
342
- this . _change . markForCheck ( ) ;
343
- }
310
+ set disableRipple ( value ) { this . _disableRipple = coerceBooleanProperty ( value ) ; }
344
311
345
312
/**
346
313
* Event emitted when the checked state of this radio button changes.
@@ -356,7 +323,6 @@ export class MdRadioButton implements OnInit {
356
323
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
357
324
private _elementRef : ElementRef ,
358
325
private _renderer : Renderer ,
359
- private _change : ChangeDetectorRef ,
360
326
public radioDispatcher : UniqueSelectionDispatcher ) {
361
327
// Assertions. Ideally these should be stripped out by the compiler.
362
328
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -398,7 +364,6 @@ export class MdRadioButton implements OnInit {
398
364
// Notify all radio buttons with the same name to un-check.
399
365
this . radioDispatcher . notify ( this . id , this . name ) ;
400
366
}
401
- this . _change . markForCheck ( ) ;
402
367
}
403
368
}
404
369
@@ -420,7 +385,6 @@ export class MdRadioButton implements OnInit {
420
385
this . radioGroup . selected = this ;
421
386
}
422
387
}
423
- this . _change . markForCheck ( ) ;
424
388
}
425
389
}
426
390
@@ -437,7 +401,6 @@ export class MdRadioButton implements OnInit {
437
401
438
402
set align ( v ) {
439
403
this . labelPosition = ( v == 'start' ) ? 'after' : 'before' ;
440
- this . _change . markForCheck ( ) ;
441
404
}
442
405
443
406
private _labelPosition : 'before' | 'after' ;
@@ -450,7 +413,6 @@ export class MdRadioButton implements OnInit {
450
413
451
414
set labelPosition ( value ) {
452
415
this . _labelPosition = value ;
453
- this . _change . markForCheck ( ) ;
454
416
}
455
417
456
418
/** Whether the radio button is disabled. */
@@ -463,7 +425,6 @@ export class MdRadioButton implements OnInit {
463
425
set disabled ( value : boolean ) {
464
426
// The presence of *any* disabled value makes the component disabled, *except* for false.
465
427
this . _disabled = ( value != null && value !== false ) ? true : null ;
466
- this . _change . markForCheck ( ) ;
467
428
}
468
429
469
430
ngOnInit ( ) {
0 commit comments