Skip to content

Commit 9c18e4f

Browse files
committed
.
1 parent ff223a9 commit 9c18e4f

File tree

1 file changed

+7
-46
lines changed

1 file changed

+7
-46
lines changed

src/lib/radio/radio.ts

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,14 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
128128
}
129129

130130
/** 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';
144132

145133
/** Whether the radio button is disabled. */
146134
@Input()
147135
get disabled(): boolean { return this._disabled; }
148136
set disabled(value) {
149137
// The presence of *any* disabled value makes the component disabled, *except* for false.
150138
this._disabled = (value != null && value !== false) ? true : null;
151-
if (this._radios) {
152-
this._radios.forEach((radio) => {
153-
radio.disabled = this._disabled;
154-
})
155-
}
156139
}
157140

158141
/** Value of the radio button. */
@@ -183,6 +166,8 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
183166
this._checkSelectedRadioButton();
184167
}
185168

169+
constructor(private _change: ChangeDetectorRef) {}
170+
186171
/**
187172
* Initialize properties once content children are available.
188173
* This allows us to propagate relevant attributes to associated buttons.
@@ -244,6 +229,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
244229
*/
245230
writeValue(value: any) {
246231
this.value = value;
232+
this._change.markForCheck();
247233
}
248234

249235
/**
@@ -299,34 +285,15 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
299285
@Input() name: string;
300286

301287
/** 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;
311289

312290
/** 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;
322292

323293
/** Whether the ripple effect for this radio button is disabled. */
324294
@Input()
325295
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); }
330297

331298
/**
332299
* Event emitted when the checked state of this radio button changes.
@@ -342,7 +309,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
342309
constructor(@Optional() radioGroup: MdRadioGroup,
343310
private _elementRef: ElementRef,
344311
private _renderer: Renderer,
345-
private _change: ChangeDetectorRef,
346312
public radioDispatcher: UniqueSelectionDispatcher) {
347313
// Assertions. Ideally these should be stripped out by the compiler.
348314
// 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 {
383349
// Notify all radio buttons with the same name to un-check.
384350
this._radioDispatcher.notify(this.id, this.name);
385351
}
386-
this._change.markForCheck();
387352
}
388353
}
389354

@@ -405,7 +370,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
405370
this.radioGroup.selected = this;
406371
}
407372
}
408-
this._change.markForCheck();
409373
}
410374
}
411375

@@ -422,7 +386,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
422386

423387
set align(v) {
424388
this.labelPosition = (v == 'start') ? 'after' : 'before';
425-
this._change.markForCheck();
426389
}
427390

428391
private _labelPosition: 'before' | 'after';
@@ -435,7 +398,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
435398

436399
set labelPosition(value) {
437400
this._labelPosition = value;
438-
this._change.markForCheck();
439401
}
440402

441403
/** Whether the radio button is disabled. */
@@ -447,7 +409,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
447409
set disabled(value: boolean) {
448410
// The presence of *any* disabled value makes the component disabled, *except* for false.
449411
this._disabled = (value != null && value !== false) ? true : null;
450-
this._change.markForCheck();
451412
}
452413

453414
/**

0 commit comments

Comments
 (0)