src/lib/pg-components/switch/switch.component.ts
Example of usage:
OnInit
ControlValueAccessor
encapsulation | ViewEncapsulation.None |
providers |
MefDevSwitchComponent.switchValueAccessor()
|
selector | mefdev-switch |
templateUrl | ./switch.component.html |
Properties |
Methods |
Inputs |
Outputs |
HostListeners |
Accessors |
Color |
Type : string
|
Sets the color of the switch. Usage example:
|
Disabled |
Type : boolean
|
Sets the disabled state of the switch. Usage example:
|
Size |
Type : string
|
Sets the size of the switch. Usage example:
|
Value |
Type : boolean
|
Sets the value of the switch. Usage example:
|
onChange |
Type : function
|
click |
Arguments : '$event'
|
click(e: MouseEvent)
|
onClick | ||||||
onClick(e: MouseEvent)
|
||||||
Decorators :
@HostListener('click', ['$event'])
|
||||||
Parameters :
Returns :
void
|
registerOnChange | ||||||||
registerOnChange(fn: (_: boolean) => void)
|
||||||||
Registers a callback function to be executed when the switch value changes. Usage example:
Parameters :
Returns :
void
|
registerOnTouched | ||||||||
registerOnTouched(fn: () => void)
|
||||||||
Registers a callback function to be executed when the switch is touched. Usage example:
Parameters :
Returns :
void
|
setClassMap |
setClassMap()
|
Sets the class map for the switch. Usage example:
Returns :
void
|
setDisabledState | ||||||||
setDisabledState(isDisabled: boolean)
|
||||||||
Sets the disabled state of the switch. Usage example:
Parameters :
Returns :
void
|
Static switchValueAccessor |
switchValueAccessor()
|
Get the value accessor provider configuration for the switch component.
Returns :
any
|
updateValue | ||||||||
updateValue(value: boolean)
|
||||||||
Updates the value of the switch. Usage example:
Parameters :
Returns :
void
|
Public writeValue | ||||||||
writeValue(value: boolean)
|
||||||||
Writes a new value to the switch. Usage example:
Parameters :
Returns :
void
|
_checked |
Default value : false
|
_classMap |
Type : any
|
_color |
Type : string
|
Default value : "primary"
|
_innerPrefixCls |
Default value : `${this._prefixCls}-inner `
|
_prefixCls |
Type : string
|
Default value : "toggle-switch"
|
_size |
Type : string
|
onTouched |
Type : function
|
Default value : () => {...}
|
Value | ||||||||
setValue(value: boolean)
|
||||||||
Sets the value of the switch. Usage example:
Parameters :
Returns :
void
|
Size | ||||||||
getSize()
|
||||||||
Gets the current size of the switch. Usage example:
Returns :
string
|
||||||||
setSize(value: string)
|
||||||||
Sets the size of the switch. Usage example:
Parameters :
Returns :
void
|
Color | ||||||||
setColor(value: string)
|
||||||||
Sets the color of the switch. Usage example:
Parameters :
Returns :
void
|
Disabled | ||||||||
getDisabled()
|
||||||||
Gets the current disabled state of the switch. Usage example:
Returns :
boolean
|
||||||||
setDisabled(value: boolean)
|
||||||||
Sets the disabled state of the switch. Usage example:
Parameters :
Returns :
void
|