From 75cd73ba2eaf8b94fc9cce6efebbc2aae08ca126 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 20 Dec 2016 22:53:24 +0100 Subject: [PATCH] chore(slide-toggle): add initial documentation of properties (#2261) * Adds a basic documentation of the public properties like in the checkbox component. --- src/lib/slide-toggle/slide-toggle.html | 2 +- src/lib/slide-toggle/slide-toggle.ts | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/lib/slide-toggle/slide-toggle.html b/src/lib/slide-toggle/slide-toggle.html index b1826671dd1..16fbccc860d 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; @@ -178,11 +190,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; @@ -195,6 +209,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; @@ -204,6 +219,7 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor { this._updateColor(value); } + /** Toggles the checked state of the slide-toggle. */ toggle() { this.checked = !this.checked; }