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