1- import { Component , Input , Output , EventEmitter , HostBinding , HostListener , ViewChild , ElementRef , ContentChild , ChangeDetectionStrategy } from '@angular/core'
1+ import { Component , Input , Output , EventEmitter , HostBinding , HostListener , ViewChild , ElementRef , ContentChild , ChangeDetectionStrategy , ChangeDetectorRef } from '@angular/core'
2+ import { ColorsService } from '../../services/colors.service'
23
34@Component ( {
45 selector : 'eqm-checkbox' ,
@@ -8,16 +9,24 @@ import { Component, Input, Output, EventEmitter, HostBinding, HostListener, View
89} )
910export class CheckboxComponent {
1011 @Input ( ) labelSide : 'left' | 'right'
12+ @Input ( ) labelColor = ColorsService . light
1113 @Input ( ) interactive : boolean = true
1214 @Input ( ) checked : boolean = false
13- @Output ( ) checkedChanged = new EventEmitter < boolean > ( )
15+ @Output ( ) checkedChange = new EventEmitter < boolean > ( )
16+ @Input ( ) color = ColorsService . accent
17+ @Input ( ) bgColor = ColorsService . dark
1418 @HostBinding ( 'class.enabled' ) @Input ( ) enabled = true
1519
20+ constructor (
21+ private readonly change : ChangeDetectorRef
22+ ) { }
23+
1624 @HostListener ( 'click' )
1725 toggle ( ) {
1826 if ( this . interactive && this . enabled ) {
1927 this . checked = ! this . checked
20- this . checkedChanged . emit ( this . checked )
28+ this . checkedChange . emit ( this . checked )
29+ this . change . detectChanges ( )
2130 }
2231 }
2332}
0 commit comments