Browse Source

Refactoring

pull/2838/head
Thomas Kaul 2 years ago
parent
commit
00b4963cc6
  1. 2
      apps/client/src/app/components/toggle/toggle.component.html
  2. 6
      apps/client/src/app/components/toggle/toggle.component.ts

2
apps/client/src/app/components/toggle/toggle.component.html

@ -1,6 +1,6 @@
<mat-radio-group
class="d-block text-nowrap"
[formControl]="option"
[formControl]="optionFormControl"
(change)="onValueChange()"
>
<mat-radio-button

6
apps/client/src/app/components/toggle/toggle.component.ts

@ -31,17 +31,17 @@ export class ToggleComponent implements OnChanges, OnInit {
@Output() change = new EventEmitter<Pick<ToggleOption, 'value'>>();
public option = new FormControl<string>(undefined);
public optionFormControl = new FormControl<string>(undefined);
public constructor() {}
public ngOnInit() {}
public ngOnChanges() {
this.option.setValue(this.defaultValue);
this.optionFormControl.setValue(this.defaultValue);
}
public onValueChange() {
this.change.emit({ value: this.option.value });
this.change.emit({ value: this.optionFormControl.value });
}
}

Loading…
Cancel
Save