diff --git a/libs/ui/src/lib/toggle/toggle.component.ts b/libs/ui/src/lib/toggle/toggle.component.ts index be460f7fa..655a841b8 100644 --- a/libs/ui/src/lib/toggle/toggle.component.ts +++ b/libs/ui/src/lib/toggle/toggle.component.ts @@ -26,13 +26,17 @@ export class GfToggleComponent implements OnChanges { @Output() valueChange = new EventEmitter>(); - public optionFormControl = new FormControl(undefined); + public optionFormControl = new FormControl(null); public ngOnChanges() { this.optionFormControl.setValue(this.defaultValue); } public onValueChange() { - this.valueChange.emit({ value: this.optionFormControl.value }); + const value = this.optionFormControl.value; + + if (value !== null) { + this.valueChange.emit({ value }); + } } }