Browse Source

feat(lib): implement output signal for valueChange

pull/6533/head
KenTandrian 3 weeks ago
parent
commit
11c9256817
  1. 7
      libs/ui/src/lib/toggle/toggle.component.ts

7
libs/ui/src/lib/toggle/toggle.component.ts

@ -4,10 +4,9 @@ import { CommonModule } from '@angular/common';
import { import {
ChangeDetectionStrategy, ChangeDetectionStrategy,
Component, Component,
EventEmitter,
Input, Input,
OnChanges, OnChanges,
Output output
} from '@angular/core'; } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { MatRadioModule } from '@angular/material/radio'; import { MatRadioModule } from '@angular/material/radio';
@ -24,10 +23,10 @@ export class GfToggleComponent implements OnChanges {
@Input() isLoading: boolean; @Input() isLoading: boolean;
@Input() options: ToggleOption[] = []; @Input() options: ToggleOption[] = [];
@Output() valueChange = new EventEmitter<Pick<ToggleOption, 'value'>>();
public optionFormControl = new FormControl<string | null>(null); public optionFormControl = new FormControl<string | null>(null);
protected readonly valueChange = output<Pick<ToggleOption, 'value'>>();
public ngOnChanges() { public ngOnChanges() {
this.optionFormControl.setValue(this.defaultValue); this.optionFormControl.setValue(this.defaultValue);
} }

Loading…
Cancel
Save