File

qwc/projects/qwc/src/lib/components/qwc-toggle/qwc-toggle.component.ts

Description

Render qwc-toggle and handle its events.

Implements

ControlValueAccessor AfterViewInit

Metadata

providers { provide: NG_VALUE_ACCESSOR, useExisting: QwcToggle, multi: true, }
selector qwc-toggle
templateUrl ./qwc-toggle.component.html

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(_elementRef: ElementRef, renderer: Renderer2)
Parameters :
Name Type Optional
_elementRef ElementRef No
renderer Renderer2 No

Inputs

ariaDescription
Type : string | null
Default value : null

Used to set the aria-description attribute on the underlying input element.

ariaLabel
Type : string | null
Default value : null

Used to set the aria-label attribute on the underlying input element.

ariaLabelledby
Type : string | null
Default value : null

Used to set the aria-labelledby attribute on the underlying input element.

emitOnInitialChange
Default value : true

Used to skip initial change.

inputId
Default value : ""
inputLabel
Default value : ""
value

Used to set current state of qwc-toggle

Outputs

valueChange
Type : EventEmitter

Methods

coerceBooleanProperty
coerceBooleanProperty(value: any)

Coerce boolean property

Parameters :
Name Type Optional Description
value any No

Value

Returns : boolean

boolean

getHostElement
getHostElement()

Get host element

Returns : any

ElementRef

hasHostAttributes
hasHostAttributes(...attributes: string[])

Host attributes

Parameters :
Name Type Optional Description
attributes string[] No

Attributes

Returns : any

string[]

ngAfterViewInit
ngAfterViewInit()

Component lifecycle hook

Returns : void

void

registerOnChange
registerOnChange(fn: (_: any) => void)

Register on change

Parameters :
Name Type Optional Description
fn function No

Function

Returns : void

void

registerOnTouched
registerOnTouched(fn: () => void)

Register on touched

Parameters :
Name Type Optional Description
fn function No

Function

Returns : void

void

setDisabledState
setDisabledState(isDisabled: boolean)

Set disabled state

Parameters :
Name Type Optional Description
isDisabled boolean No

Is disabled

Returns : void

void

toggle
toggle()

Changes the state of qwc-toggle

Returns : void

void

updateHostAttribute
updateHostAttribute(value)

Update host attribute

Parameters :
Name Optional Description
value No

Value

Returns : void

void

writeValue
writeValue(value: boolean)

WriteValue, registerOnChange, registerOnTouched functions are a part of the ControlValueAccessor interface. These allow for the implementation of logic which gets implemented when a value is written, changed or the input field is touched.

Parameters :
Name Type Optional
value boolean No
Returns : void

Properties

checkBoxElement
Type : any
Decorators :
@ViewChild('checkBoxEl')

Accessors

value
setvalue(val)
Parameters :
Name Optional
val No
Returns : void
disabled
getdisabled()

Used to set disabled attribute upon underlying input element.

result-matching ""

    No results matching ""