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-describedby')
|
Used to set the aria-describedby attribute on the underlying input element. |
@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. |
|
Default color to fall back to if no value is set. |
|
Tabindex to which to fall back to if no value is set. |
|
|
|
Returns the unique id for the visual hidden input. |
focus | |
---|---|
Focuses the slide-toggle. |
|
Parameters | |
options? FocusOptions
|
|
origin? FocusOrigin
|
|
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 |
---|---|
|
Tracks changes to the required attribute bound to this directive. |
registerOnValidatorChange | |
---|---|
Registers a callback function to call when the validator inputs change. |
|
Parameters | |
fn () => void
|
|
validate | |
---|---|
Method that validates whether or not the checkbox has been checked. Returns the validation result if enabled, otherwise null. |
|
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 |
---|---|
|
Default color for slide toggles. |
|
Whether toggle 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;