Skip to content

Commit d452816

Browse files
committed
.
1 parent 8ff1a9f commit d452816

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
@@ -127,31 +127,14 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
127127
}
128128

129129
/** 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';
143131

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

157140
/** Value of the radio button. */
@@ -182,6 +165,8 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
182165
this._checkSelectedRadioButton();
183166
}
184167

168+
constructor(private _change: ChangeDetectorRef) {}
169+
185170
/**
186171
* Initialize properties once content children are available.
187172
* This allows us to propagate relevant attributes to associated buttons.
@@ -243,6 +228,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
243228
*/
244229
writeValue(value: any) {
245230
this.value = value;
231+
this._change.markForCheck();
246232
}
247233

248234
/**
@@ -301,26 +287,10 @@ export class MdRadioButton implements OnInit {
301287
name: string;
302288

303289
/** 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;
313291

314292
/** 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;
324294

325295
/** Whether this radio is disabled. */
326296
private _disabled: boolean;
@@ -337,10 +307,7 @@ export class MdRadioButton implements OnInit {
337307
/** Whether the ripple effect for this radio button is disabled. */
338308
@Input()
339309
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); }
344311

345312
/**
346313
* Event emitted when the checked state of this radio button changes.
@@ -356,7 +323,6 @@ export class MdRadioButton implements OnInit {
356323
constructor(@Optional() radioGroup: MdRadioGroup,
357324
private _elementRef: ElementRef,
358325
private _renderer: Renderer,
359-
private _change: ChangeDetectorRef,
360326
public radioDispatcher: UniqueSelectionDispatcher) {
361327
// Assertions. Ideally these should be stripped out by the compiler.
362328
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -398,7 +364,6 @@ export class MdRadioButton implements OnInit {
398364
// Notify all radio buttons with the same name to un-check.
399365
this.radioDispatcher.notify(this.id, this.name);
400366
}
401-
this._change.markForCheck();
402367
}
403368
}
404369

@@ -420,7 +385,6 @@ export class MdRadioButton implements OnInit {
420385
this.radioGroup.selected = this;
421386
}
422387
}
423-
this._change.markForCheck();
424388
}
425389
}
426390

@@ -437,7 +401,6 @@ export class MdRadioButton implements OnInit {
437401

438402
set align(v) {
439403
this.labelPosition = (v == 'start') ? 'after' : 'before';
440-
this._change.markForCheck();
441404
}
442405

443406
private _labelPosition: 'before' | 'after';
@@ -450,7 +413,6 @@ export class MdRadioButton implements OnInit {
450413

451414
set labelPosition(value) {
452415
this._labelPosition = value;
453-
this._change.markForCheck();
454416
}
455417

456418
/** Whether the radio button is disabled. */
@@ -463,7 +425,6 @@ export class MdRadioButton implements OnInit {
463425
set disabled(value: boolean) {
464426
// The presence of *any* disabled value makes the component disabled, *except* for false.
465427
this._disabled = (value != null && value !== false) ? true : null;
466-
this._change.markForCheck();
467428
}
468429

469430
ngOnInit() {

0 commit comments

Comments
 (0)