@@ -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
/**
@@ -299,34 +285,15 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
299
285
@Input ( ) name : string ;
300
286
301
287
/** Used to set the 'aria-label' attribute on the underlying input element. */
302
- _ariaLabel : string ;
303
- @Input ( 'aria-label' )
304
- get ariaLabel ( ) : string {
305
- return this . _ariaLabel ;
306
- }
307
- set ariaLabel ( value : string ) {
308
- this . _ariaLabel = value ;
309
- this . _change . markForCheck ( ) ;
310
- }
288
+ @Input ( 'aria-label' ) ariaLabel : string ;
311
289
312
290
/** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */
313
- _ariaLabelledby : string ;
314
- @Input ( 'aria-labelledby' )
315
- get ariaLabelledby ( ) : string {
316
- return this . _ariaLabelledby ;
317
- }
318
- set ariaLabelledby ( value : string ) {
319
- this . _ariaLabelledby = value ;
320
- this . _change . markForCheck ( ) ;
321
- }
291
+ @Input ( 'aria-labelledby' ) ariaLabelledby : string ;
322
292
323
293
/** Whether the ripple effect for this radio button is disabled. */
324
294
@Input ( )
325
295
get disableRipple ( ) : boolean { return this . _disableRipple ; }
326
- set disableRipple ( value ) {
327
- this . _disableRipple = coerceBooleanProperty ( value ) ;
328
- this . _change . markForCheck ( ) ;
329
- }
296
+ set disableRipple ( value ) { this . _disableRipple = coerceBooleanProperty ( value ) ; }
330
297
331
298
/**
332
299
* Event emitted when the checked state of this radio button changes.
@@ -342,7 +309,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
342
309
constructor ( @Optional ( ) radioGroup : MdRadioGroup ,
343
310
private _elementRef : ElementRef ,
344
311
private _renderer : Renderer ,
345
- private _change : ChangeDetectorRef ,
346
312
public radioDispatcher : UniqueSelectionDispatcher ) {
347
313
// Assertions. Ideally these should be stripped out by the compiler.
348
314
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -383,7 +349,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
383
349
// Notify all radio buttons with the same name to un-check.
384
350
this . _radioDispatcher . notify ( this . id , this . name ) ;
385
351
}
386
- this . _change . markForCheck ( ) ;
387
352
}
388
353
}
389
354
@@ -405,7 +370,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
405
370
this . radioGroup . selected = this ;
406
371
}
407
372
}
408
- this . _change . markForCheck ( ) ;
409
373
}
410
374
}
411
375
@@ -422,7 +386,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
422
386
423
387
set align ( v ) {
424
388
this . labelPosition = ( v == 'start' ) ? 'after' : 'before' ;
425
- this . _change . markForCheck ( ) ;
426
389
}
427
390
428
391
private _labelPosition : 'before' | 'after' ;
@@ -435,7 +398,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
435
398
436
399
set labelPosition ( value ) {
437
400
this . _labelPosition = value ;
438
- this . _change . markForCheck ( ) ;
439
401
}
440
402
441
403
/** Whether the radio button is disabled. */
@@ -447,7 +409,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
447
409
set disabled ( value : boolean ) {
448
410
// The presence of *any* disabled value makes the component disabled, *except* for false.
449
411
this . _disabled = ( value != null && value !== false ) ? true : null ;
450
- this . _change . markForCheck ( ) ;
451
412
}
452
413
453
414
/**
0 commit comments