core/list-group/list-item-checkbox.component.ts
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>
CheckboxControlValueAccessor
host | { |
providers |
{
provide: NG_VALUE_ACCESSOR, multi: true, useExisting: forwardRef(() => ListItemCheckboxComponent)
}
|
selector | c8y-list-item-checkbox, c8y-li-checkbox |
templateUrl | ./list-item-checkbox.component.html |
Methods |
Inputs |
Outputs |
constructor(renderer: Renderer2, elementRef: ElementRef)
|
|||||||||
Parameters :
|
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. |
onSelect |
Type : EventEmitter
|
An event emitted as soon as the checkbox is selected. |
select | ||||||
select(value)
|
||||||
Selects the checkbox.
Parameters :
Returns :
void
|
setDisabledState | ||||||
setDisabledState(isDisabled: boolean)
|
||||||
Parameters :
Returns :
void
|
writeValue | ||||||
writeValue(value: boolean)
|
||||||
Parameters :
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>