@@ -73,25 +73,37 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor {
73
73
// Needs to be public to support AOT compilation (as host binding).
74
74
_hasFocus : boolean = false ;
75
75
76
+ /** Name value will be applied to the input element if present */
76
77
@Input ( ) name : string = null ;
78
+
79
+ /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */
77
80
@Input ( ) id : string = this . _uniqueId ;
81
+
82
+ /** Used to specify the tabIndex value for the underlying input element. */
78
83
@Input ( ) tabIndex : number = 0 ;
84
+
85
+ /** Used to set the aria-label attribute on the underlying input element. */
79
86
@Input ( ) ariaLabel : string = null ;
87
+
88
+ /** Used to set the aria-labelledby attribute on the underlying input element. */
80
89
@Input ( ) ariaLabelledby : string = null ;
81
90
91
+ /** Whether the slide-toggle is disabled. */
82
92
@Input ( )
83
93
get disabled ( ) : boolean { return this . _disabled ; }
84
94
set disabled ( value ) { this . _disabled = coerceBooleanProperty ( value ) ; }
85
95
96
+ /** Whether the slide-toggle is required. */
86
97
@Input ( )
87
98
get required ( ) : boolean { return this . _required ; }
88
99
set required ( value ) { this . _required = coerceBooleanProperty ( value ) ; }
89
100
90
101
private _change : EventEmitter < MdSlideToggleChange > = new EventEmitter < MdSlideToggleChange > ( ) ;
102
+ /** An event will be dispatched each time the slide-toggle changes its value. */
91
103
@Output ( ) change : Observable < MdSlideToggleChange > = this . _change . asObservable ( ) ;
92
104
93
- // Returns the unique id for the visual hidden input.
94
- getInputId = ( ) => `${ this . id || this . _uniqueId } -input` ;
105
+ /** Returns the unique id for the visual hidden input. */
106
+ get inputId ( ) : string { return `${ this . id || this . _uniqueId } -input` ; }
95
107
96
108
@ViewChild ( 'input' ) _inputElement : ElementRef ;
97
109
@@ -178,11 +190,13 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor {
178
190
this . disabled = isDisabled ;
179
191
}
180
192
193
+ /** Focuses the slide-toggle. */
181
194
focus ( ) {
182
195
this . _renderer . invokeElementMethod ( this . _inputElement . nativeElement , 'focus' ) ;
183
196
this . _onInputFocus ( ) ;
184
197
}
185
198
199
+ /** Whether the slide-toggle is checked. */
186
200
@Input ( )
187
201
get checked ( ) {
188
202
return ! ! this . _checked ;
@@ -195,6 +209,7 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor {
195
209
}
196
210
}
197
211
212
+ /** The color of the slide-toggle. Can be primary, accent, or warn. */
198
213
@Input ( )
199
214
get color ( ) : string {
200
215
return this . _color ;
@@ -204,6 +219,7 @@ export class MdSlideToggle implements AfterContentInit, ControlValueAccessor {
204
219
this . _updateColor ( value ) ;
205
220
}
206
221
222
+ /** Toggles the checked state of the slide-toggle. */
207
223
toggle ( ) {
208
224
this . checked = ! this . checked ;
209
225
}
0 commit comments