Skip to content

Commit 44ef4c0

Browse files
committed
.
1 parent e73ad6b commit 44ef4c0

File tree

1 file changed

+7
-40
lines changed

1 file changed

+7
-40
lines changed

src/lib/radio/radio.ts

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,7 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
132132
}
133133

134134
/** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
135-
_labelPosition: 'before' | 'after' = 'after';
136-
@Input()
137-
get labelPosition(): 'before' | 'after' {
138-
return this._labelPosition;
139-
}
140-
set labelPosition(v: 'before' | 'after') {
141-
this._labelPosition = v
142-
if (this._radios) {
143-
this._radios.forEach((radio) => {
144-
radio.labelPosition = this._labelPosition;
145-
});
146-
}
147-
}
135+
@Input() labelPosition: 'before' | 'after' = 'after';
148136

149137
/** Value of the radio button. */
150138
@Input()
@@ -174,6 +162,8 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
174162
this._checkSelectedRadioButton();
175163
}
176164

165+
constructor(private _change: ChangeDetectorRef) {}
166+
177167
/**
178168
* Initialize properties once content children are available.
179169
* This allows us to propagate relevant attributes to associated buttons.
@@ -235,6 +225,7 @@ export class MdRadioGroup extends _MdRadioGroupMixinBase
235225
*/
236226
writeValue(value: any) {
237227
this.value = value;
228+
this._change.markForCheck();
238229
}
239230

240231
/**
@@ -290,34 +281,15 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
290281
@Input() name: string;
291282

292283
/** Used to set the 'aria-label' attribute on the underlying input element. */
293-
_ariaLabel: string;
294-
@Input('aria-label')
295-
get ariaLabel(): string {
296-
return this._ariaLabel;
297-
}
298-
set ariaLabel(value: string) {
299-
this._ariaLabel = value;
300-
this._change.markForCheck();
301-
}
284+
@Input('aria-label') ariaLabel: string;
302285

303286
/** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */
304-
_ariaLabelledby: string;
305-
@Input('aria-labelledby')
306-
get ariaLabelledby(): string {
307-
return this._ariaLabelledby;
308-
}
309-
set ariaLabelledby(value: string) {
310-
this._ariaLabelledby = value;
311-
this._change.markForCheck();
312-
}
287+
@Input('aria-labelledby') ariaLabelledby: string;
313288

314289
/** Whether the ripple effect for this radio button is disabled. */
315290
@Input()
316291
get disableRipple(): boolean { return this._disableRipple; }
317-
set disableRipple(value) {
318-
this._disableRipple = coerceBooleanProperty(value);
319-
this._change.markForCheck();
320-
}
292+
set disableRipple(value) { this._disableRipple = coerceBooleanProperty(value); }
321293

322294
/**
323295
* Event emitted when the checked state of this radio button changes.
@@ -333,7 +305,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
333305
constructor(@Optional() radioGroup: MdRadioGroup,
334306
private _elementRef: ElementRef,
335307
private _renderer: Renderer,
336-
private _change: ChangeDetectorRef,
337308
public radioDispatcher: UniqueSelectionDispatcher) {
338309
// Assertions. Ideally these should be stripped out by the compiler.
339310
// TODO(jelbourn): Assert that there's no name binding AND a parent radio group.
@@ -374,7 +345,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
374345
// Notify all radio buttons with the same name to un-check.
375346
this._radioDispatcher.notify(this.id, this.name);
376347
}
377-
this._change.markForCheck();
378348
}
379349
}
380350

@@ -396,7 +366,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
396366
this.radioGroup.selected = this;
397367
}
398368
}
399-
this._change.markForCheck();
400369
}
401370
}
402371

@@ -413,7 +382,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
413382

414383
set align(v) {
415384
this.labelPosition = (v == 'start') ? 'after' : 'before';
416-
this._change.markForCheck();
417385
}
418386

419387
private _labelPosition: 'before' | 'after';
@@ -426,7 +394,6 @@ export class MdRadioButton implements OnInit, AfterViewInit, OnDestroy {
426394

427395
set labelPosition(value) {
428396
this._labelPosition = value;
429-
this._change.markForCheck();
430397
}
431398

432399
/** Whether the radio button is disabled. */

0 commit comments

Comments
 (0)