diff --git a/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.html b/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.html index 7c44a34..3cfde6e 100644 --- a/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.html +++ b/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.html @@ -1,8 +1,9 @@
-
diff --git a/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.ts b/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.ts index c45f473..22b28bc 100644 --- a/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.ts +++ b/projects/ngx-formulus/src/lib/components/controls/checkbox-control/checkbox-control.component.ts @@ -12,4 +12,11 @@ export class CheckboxControlComponent extends BaseControlComponent { } ngOnInit(): void {} + + public onChange($event: Event): void { + if ($event) { + const target = $event.target as HTMLInputElement; + this.dynamicControl.formControl.setValue(target.checked); + } + } } diff --git a/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.html b/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.html index a2e0e96..bec8471 100644 --- a/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.html +++ b/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.html @@ -1,8 +1,9 @@
-
diff --git a/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.ts b/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.ts index 3a12e63..5b3441e 100644 --- a/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.ts +++ b/projects/ngx-formulus/src/lib/components/controls/radio-control/radio-control.component.ts @@ -12,4 +12,11 @@ export class RadioControlComponent extends BaseControlComponent { } ngOnInit(): void {} + + public onChange($event: Event): void { + if ($event) { + const target = $event.target as HTMLInputElement; + this.dynamicControl.formControl.setValue(target.checked); + } + } }