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.
<c8y-li>
<c8y-li-checkbox></c8y-li-checkbox>
</c8y-li>
| 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
|
| 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)"
/>
<span></span>
</label>
<ng-content></ng-content>