import {MatSlideToggleModule} from '@angular/material/slide-toggle';
MatSlideToggle
Represents a slidable "switch" toggle that can be moved between on and off.
Selector: mat-slide-toggle
Exported as: matSlideToggleName | Description |
---|---|
@Input('aria-label')
|
Used to set the aria-label attribute on the underlying input element. |
@Input('aria-labelledby')
|
Used to set the aria-labelledby attribute on the underlying input element. |
@Input()
|
Whether the slide-toggle element is checked or not. |
@Input()
|
Theme color palette for the component. |
@Input()
|
Whether ripples are disabled. |
@Input()
|
Whether the component is disabled. |
@Input()
|
A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. |
@Input()
|
Whether the label should appear after or before the slide-toggle. Defaults to 'after'. |
@Input()
|
Name value will be applied to the input element if present. |
@Input()
|
Whether the slide-toggle is required. |
@Output()
|
An event will be dispatched each time the slide-toggle changes its value. |
@Output()
|
An event will be dispatched each time the slide-toggle input is toggled. This event is always emitted when the user toggles the slide toggle, but this does not mean the slide toggle's value has changed. |
|
|
|
Returns the unique id for the visual hidden input. |
@Output()
Deprecated
|
An event will be dispatched each time the slide-toggle is dragged. This event is always emitted when the user drags the slide toggle to make a change greater than 50%. It does not mean the slide toggle's value is changed. The event is not emitted when the user toggles the slide toggle to change its value. |
focus | |
---|---|
Focuses the slide-toggle. |
|
Parameters | |
options? FocusOptions
|
|
toggle | |
---|---|
Toggles the checked state of the slide-toggle. |
MatSlideToggleRequiredValidator
Validator for Material slide-toggle components with the required attribute in a template-driven form. The default validator for required form controls asserts that the control value is not undefined but that is not appropriate for a slide-toggle where the value is always defined.
Required slide-toggle form controls are valid when checked.
Selector: mat-slide-toggle[required][formControlName] mat-slide-toggle[required][formControl] mat-slide-toggle[required][ngModel]
Name | Description |
---|---|
|
registerOnValidatorChange | |
---|---|
Parameters | |
fn () => void
|
|
validate | |
---|---|
Parameters | |
control AbstractControl
|
|
Returns | |
ValidationErrors | null
|
|
MatSlideToggleChange
Change event object emitted by a MatSlideToggle.
Name | Description |
---|---|
|
The new |
|
The source MatSlideToggle of the event. |
MatSlideToggleDefaultOptions
Default mat-slide-toggle
options that can be overridden.
Name | Description |
---|---|
|
Whether toggle action triggers value changes in slide toggle. |
Deprecated
|
Whether drag action triggers value changes in slide toggle. |
MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS
Injection token to be used to override the default options for mat-slide-toggle
.
const MAT_SLIDE_TOGGLE_DEFAULT_OPTIONS: InjectionToken<MatSlideToggleDefaultOptions>;
MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR
const MAT_SLIDE_TOGGLE_REQUIRED_VALIDATOR: Provider;