diff --git a/libs/ui/src/lib/toggle/toggle.component.html b/libs/ui/src/lib/toggle/toggle.component.html
index ac2256daa..d6271ef58 100644
--- a/libs/ui/src/lib/toggle/toggle.component.html
+++ b/libs/ui/src/lib/toggle/toggle.component.html
@@ -3,13 +3,14 @@
[formControl]="optionFormControl"
(change)="onValueChange()"
>
- @for (option of options; track option) {
+ @for (option of options(); track option) {
{{ option.label }}();
+ public readonly isLoading = input(false);
+ public readonly options = input([]);
- @Output() valueChange = new EventEmitter>();
+ protected readonly optionFormControl = new FormControl(null);
+ protected readonly valueChange = output>();
- public optionFormControl = new FormControl(undefined);
-
- public ngOnChanges() {
- this.optionFormControl.setValue(this.defaultValue);
+ public constructor() {
+ effect(() => {
+ 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 });
+ }
}
}