File

core/list-group/list-item-checkbox.component.ts

Description

A component to display checkboxes in a c8y-li. Use it with content projection. It can be used standalone or with an ngModel.

Example :
<c8y-li>
  <c8y-li-checkbox></c8y-li-checkbox>
</c8y-li>

Extends

CheckboxControlValueAccessor

Metadata

Index

Methods
Inputs
Outputs

Constructor

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

Inputs

disabled
Type : boolean
Default value : false

Indicates if the checkbox is disabled.

displayAsSwitch
Type : boolean
Default value : false

Allows to display the chceckbox as a switch

indeterminate
Type : boolean

Sets the checkbox into the indeterminate state.

selected
Type : boolean
Default value : false

Indicates if the checkbox is selected.

Outputs

onSelect
Type : EventEmitter

An event emitted as soon as the checkbox is selected.

Methods

select
select(value)

Selects the checkbox.

Parameters :
Name Optional Description
value No

The value to pass.

Returns : void
setDisabledState
setDisabledState(isDisabled: boolean)
Parameters :
Name Type Optional
isDisabled boolean No
Returns : void
writeValue
writeValue(value: boolean)
Parameters :
Name Type Optional
value boolean No
Returns : void
<label [ngClass]="displayAsSwitch ? 'c8y-switch c8y-switch--inline' : 'c8y-checkbox'">
  <input
    type="checkbox"
    class="form-control"
    [disabled]="disabled"
    [checked]="selected"
    (change)="select($event.target.checked); (false)"
    [indeterminate]="indeterminate"
  />
  <span></span>
  <span class="sr-only">event</span>
</label>
<ng-content></ng-content>

results matching ""

    No results matching ""