diff --git a/src/lib/slide-toggle/slide-toggle.html b/src/lib/slide-toggle/slide-toggle.html index b1826671dd17..16fbccc860d5 100644 --- a/src/lib/slide-toggle/slide-toggle.html +++ b/src/lib/slide-toggle/slide-toggle.html @@ -14,7 +14,7 @@ = new EventEmitter(); + /** An event will be dispatched each time the slide-toggle changes its value. */ @Output() change: Observable = this._change.asObservable(); - // Returns the unique id for the visual hidden input. - getInputId = () => `${this.id || this._uniqueId}-input`; + /** Returns the unique id for the visual hidden input. */ + get inputId(): string { return `${this.id || this._uniqueId}-input`; } @ViewChild('input') _inputElement: ElementRef; @@ -177,11 +189,13 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor { this.disabled = isDisabled; } + /** Focuses the slide-toggle. */ focus() { this._renderer.invokeElementMethod(this._inputElement.nativeElement, 'focus'); this._onInputFocus(); } + /** Whether the slide-toggle is checked. */ @Input() get checked() { return !!this._checked; @@ -194,6 +208,7 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor { } } + /** The color of the slide-toggle. Can be primary, accent, or warn. */ @Input() get color(): string { return this._color; @@ -203,6 +218,7 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor { this._updateColor(value); } + /** Toggles the checked state of the slide-toggle. */ toggle() { this.checked = !this.checked; }